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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
41c06c31
Commit
41c06c31
authored
Jun 02, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring more things based on MR feedback
parent
a9fdf62b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
7 deletions
+13
-7
lib/gitlab/import_export/import_service.rb
lib/gitlab/import_export/import_service.rb
+2
-1
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+3
-3
lib/gitlab/import_export/repo_restorer.rb
lib/gitlab/import_export/repo_restorer.rb
+7
-2
lib/gitlab/import_export/shared.rb
lib/gitlab/import_export/shared.rb
+1
-1
No files found.
lib/gitlab/import_export/import_service.rb
View file @
41c06c31
...
@@ -45,7 +45,8 @@ module Gitlab
...
@@ -45,7 +45,8 @@ module Gitlab
def
wiki_restorer
def
wiki_restorer
Gitlab
::
ImportExport
::
RepoRestorer
.
new
(
path_to_bundle:
wiki_repo_path
,
Gitlab
::
ImportExport
::
RepoRestorer
.
new
(
path_to_bundle:
wiki_repo_path
,
shared:
@shared
,
shared:
@shared
,
project:
ProjectWiki
.
new
(
project_tree
.
project
))
project:
ProjectWiki
.
new
(
project_tree
.
project
),
wiki:
true
)
end
end
def
uploads_restorer
def
uploads_restorer
...
...
lib/gitlab/import_export/relation_factory.rb
View file @
41c06c31
...
@@ -30,7 +30,7 @@ module Gitlab
...
@@ -30,7 +30,7 @@ module Gitlab
set_note_author
if
@relation_name
==
:notes
set_note_author
if
@relation_name
==
:notes
update_user_references
update_user_references
update_project_references
update_project_references
reset_tokens
if
@relation_name
==
'Ci::Trigger'
reset_
ci_
tokens
if
@relation_name
==
'Ci::Trigger'
generate_imported_object
generate_imported_object
end
end
...
@@ -95,10 +95,10 @@ module Gitlab
...
@@ -95,10 +95,10 @@ module Gitlab
end
end
end
end
def
reset_tokens
def
reset_
ci_
tokens
return
unless
Gitlab
::
ImportExport
.
reset_tokens?
return
unless
Gitlab
::
ImportExport
.
reset_tokens?
# If we import/export a project to the same instance, tokens will have to be rese
ated
.
# If we import/export a project to the same instance, tokens will have to be rese
t
.
@relation_hash
[
'token'
]
=
nil
@relation_hash
[
'token'
]
=
nil
end
end
...
...
lib/gitlab/import_export/repo_restorer.rb
View file @
41c06c31
...
@@ -3,14 +3,15 @@ module Gitlab
...
@@ -3,14 +3,15 @@ module Gitlab
class
RepoRestorer
class
RepoRestorer
include
Gitlab
::
ImportExport
::
CommandLineUtil
include
Gitlab
::
ImportExport
::
CommandLineUtil
def
initialize
(
project
:,
shared
:,
path_to_bundle
:)
def
initialize
(
project
:,
shared
:,
path_to_bundle
:
,
wiki:
false
)
@project
=
project
@project
=
project
@path_to_bundle
=
path_to_bundle
@path_to_bundle
=
path_to_bundle
@shared
=
shared
@shared
=
shared
@wiki
=
wiki
end
end
def
restore
def
restore
return
true
unless
File
.
exists?
(
@path_to_bundle
)
return
false
unless
File
.
exists?
(
@path_to_bundle
)
||
wiki?
FileUtils
.
mkdir_p
(
path_to_repo
)
FileUtils
.
mkdir_p
(
path_to_repo
)
...
@@ -29,6 +30,10 @@ module Gitlab
...
@@ -29,6 +30,10 @@ module Gitlab
def
path_to_repo
def
path_to_repo
@project
.
repository
.
path_to_repo
@project
.
repository
.
path_to_repo
end
end
def
wiki?
@wiki
end
end
end
end
end
end
end
lib/gitlab/import_export/shared.rb
View file @
41c06c31
...
@@ -10,7 +10,7 @@ module Gitlab
...
@@ -10,7 +10,7 @@ module Gitlab
end
end
def
export_path
def
export_path
@export_path
||=
Gitlab
::
ImportExport
.
export_path
(
relative_path:
@
opts
[
:relative_path
])
@export_path
||=
Gitlab
::
ImportExport
.
export_path
(
relative_path:
opts
[
:relative_path
])
end
end
def
error
(
error
)
def
error
(
error
)
...
...
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