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
Jérome Perrin
gitlab-ce
Commits
8f973b8f
Commit
8f973b8f
authored
Apr 22, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more refactoring - easier guessing path changes
parent
45032bf4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
13 deletions
+17
-13
app/services/projects/import_export/import_service.rb
app/services/projects/import_export/import_service.rb
+8
-4
lib/gitlab/import_export/command_line_util.rb
lib/gitlab/import_export/command_line_util.rb
+2
-2
lib/gitlab/import_export/importer.rb
lib/gitlab/import_export/importer.rb
+4
-4
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+1
-1
lib/gitlab/import_export/repo_restorer.rb
lib/gitlab/import_export/repo_restorer.rb
+2
-2
No files found.
app/services/projects/import_export/import_service.rb
View file @
8f973b8f
...
...
@@ -2,8 +2,8 @@ module Projects
module
ImportExport
class
ExportService
<
BaseService
def
execute
(
options
=
{})
@import_path
=
options
[
:import_path
]
archive_file
=
options
[
:archive_file
]
Gitlab
::
ImportExport
::
Importer
.
import
(
archive_file:
archive_file
,
storage_path:
storage_path
)
restore_project_tree
restore_repo
(
project_tree
.
project
)
end
...
...
@@ -15,11 +15,15 @@ module Projects
end
def
project_tree
@project_tree
||=
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
@import
_path
,
user:
@current_user
)
@project_tree
||=
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
path:
storage
_path
,
user:
@current_user
)
end
def
restore_repo
(
project
)
Gitlab
::
ImportExport
::
RepoRestorer
.
new
(
path:
@import_path
,
project:
project
).
restore
Gitlab
::
ImportExport
::
RepoRestorer
.
new
(
path:
storage_path
,
project:
project
).
restore
end
def
storage_path
@storage_path
||=
Gitlab
::
ImportExport
.
export_path
(
relative_path:
project
.
path_with_namespace
)
end
end
end
...
...
lib/gitlab/import_export/command_line_util.rb
View file @
8f973b8f
...
...
@@ -24,13 +24,13 @@ module Gitlab
end
def
tar_with_options
(
archive
:,
dir
:,
options
:)
cmd
=
%W(tar -
#{
options
}
#{
archive
}
-C
#{
dir
}
.
)
cmd
=
%W(tar -
#{
options
}
#{
archive
}
-C
#{
dir
}
)
_output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
status
.
zero?
end
def
untar_with_options
(
archive
:,
dir
:,
options
:)
cmd
=
%W(tar -
#{
options
}
#{
archive
)
}
-C
#{
dir
}
)
cmd
=
%W(tar -
#{
options
}
#{
archive
}
-C
#{
dir
}
)
_output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
status
.
zero?
end
...
...
lib/gitlab/import_export/importer.rb
View file @
8f973b8f
...
...
@@ -7,19 +7,19 @@ module Gitlab
new
(
*
args
).
import
end
def
initialize
(
archive_file
:,
storage_path
:)
def
initialize
(
archive_file:
,
storage_path
:)
@archive_file
=
archive_file
@storage_path
=
storage_path
end
def
import
decompress_
export
decompress_
archive
end
private
def
decompress
untar_czf
(
archive:
archive_file
,
dir:
@storage_path
)
def
decompress
_archive
untar_czf
(
archive:
@
archive_file
,
dir:
@storage_path
)
end
end
end
...
...
lib/gitlab/import_export/project_tree_restorer.rb
View file @
8f973b8f
...
...
@@ -4,7 +4,7 @@ module Gitlab
attr_reader
:project
def
initialize
(
path
:,
user
:)
@path
=
path
@path
=
File
.
join
(
path
,
'project.json'
)
@user
=
user
end
...
...
lib/gitlab/import_export/repo_restorer.rb
View file @
8f973b8f
...
...
@@ -3,9 +3,9 @@ module Gitlab
class
RepoRestorer
include
Gitlab
::
ImportExport
::
CommandLineUtil
def
initialize
(
project:
,
path:
)
def
initialize
(
project:
,
path
:
,
bundler_file:
)
@project
=
project
@path
=
path
@path
=
File
.
join
(
path
,
bundler_file
)
end
def
restore
...
...
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