Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
cec4ae55
Commit
cec4ae55
authored
Apr 27, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quite a few fixes - import service
parent
34c826a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
12 deletions
+9
-12
lib/gitlab/import_export/command_line_util.rb
lib/gitlab/import_export/command_line_util.rb
+3
-9
lib/gitlab/import_export/import_service.rb
lib/gitlab/import_export/import_service.rb
+2
-2
lib/gitlab/import_export/importer.rb
lib/gitlab/import_export/importer.rb
+1
-0
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+3
-1
No files found.
lib/gitlab/import_export/command_line_util.rb
View file @
cec4ae55
...
@@ -6,11 +6,11 @@ module Gitlab
...
@@ -6,11 +6,11 @@ module Gitlab
end
end
def
untar_czf
(
archive
:,
dir
:)
def
untar_czf
(
archive
:,
dir
:)
un
tar_with_options
(
archive:
archive
,
dir:
dir
,
options:
'czf'
)
tar_with_options
(
archive:
archive
,
dir:
dir
,
options:
'czf'
)
end
end
def
untar_cf
(
archive
:,
dir
:)
def
untar_cf
(
archive
:,
dir
:)
un
tar_with_options
(
archive:
archive
,
dir:
dir
,
options:
'cf'
)
tar_with_options
(
archive:
archive
,
dir:
dir
,
options:
'cf'
)
end
end
def
tar_czf
(
archive
:,
dir
:)
def
tar_czf
(
archive
:,
dir
:)
...
@@ -24,13 +24,7 @@ module Gitlab
...
@@ -24,13 +24,7 @@ module Gitlab
end
end
def
tar_with_options
(
archive
:,
dir
:,
options
:)
def
tar_with_options
(
archive
:,
dir
:,
options
:)
cmd
=
%W(tar -
#{
options
}
#{
archive
}
-C
#{
dir
}
)
cmd
=
%W(tar -
#{
options
}
#{
archive
}
#{
dir
}
)
_output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
status
.
zero?
end
def
untar_with_options
(
archive
:,
dir
:,
options
:)
cmd
=
%W(tar -
#{
options
}
#{
archive
}
-C
#{
dir
}
)
_output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
_output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
status
.
zero?
status
.
zero?
end
end
...
...
lib/gitlab/import_export/import_service.rb
View file @
cec4ae55
...
@@ -3,7 +3,7 @@ module Gitlab
...
@@ -3,7 +3,7 @@ module Gitlab
class
ImportService
class
ImportService
def
self
.
execute
(
*
args
)
def
self
.
execute
(
*
args
)
new
(
args
).
execute
new
(
*
args
).
execute
end
end
def
initialize
(
archive_file
:,
owner
:,
namespace_id
:,
project_path
:)
def
initialize
(
archive_file
:,
owner
:,
namespace_id
:,
project_path
:)
...
@@ -26,7 +26,7 @@ module Gitlab
...
@@ -26,7 +26,7 @@ module Gitlab
end
end
def
project_tree
def
project_tree
@project_tree
||=
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
storage_path
,
user:
@current_user
)
@project_tree
||=
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
storage_path
,
user:
@current_user
,
project_path:
@project_path
)
end
end
def
restore_repo
def
restore_repo
...
...
lib/gitlab/import_export/importer.rb
View file @
cec4ae55
...
@@ -13,6 +13,7 @@ module Gitlab
...
@@ -13,6 +13,7 @@ module Gitlab
end
end
def
import
def
import
FileUtils
.
mkdir_p
(
@storage_path
)
decompress_archive
decompress_archive
end
end
...
...
lib/gitlab/import_export/project_tree_restorer.rb
View file @
cec4ae55
...
@@ -3,9 +3,10 @@ module Gitlab
...
@@ -3,9 +3,10 @@ module Gitlab
class
ProjectTreeRestorer
class
ProjectTreeRestorer
attr_reader
:project
attr_reader
:project
def
initialize
(
path
:,
user
:)
def
initialize
(
path
:,
user
:
,
project_path
:
)
@path
=
File
.
join
(
path
,
'project.json'
)
@path
=
File
.
join
(
path
,
'project.json'
)
@user
=
user
@user
=
user
@project_path
=
project_path
end
end
def
restore
def
restore
...
@@ -48,6 +49,7 @@ module Gitlab
...
@@ -48,6 +49,7 @@ module Gitlab
project_params
=
@tree_hash
.
reject
{
|
_key
,
value
|
value
.
is_a?
(
Array
)
}
project_params
=
@tree_hash
.
reject
{
|
_key
,
value
|
value
.
is_a?
(
Array
)
}
project
=
Gitlab
::
ImportExport
::
ProjectFactory
.
create
(
project
=
Gitlab
::
ImportExport
::
ProjectFactory
.
create
(
project_params:
project_params
,
user:
@user
)
project_params:
project_params
,
user:
@user
)
project
.
path
=
@project_path
project
.
save
project
.
save
project
.
import_start
project
.
import_start
project
project
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment