diff options
author | James Lopez <james@jameslopez.es> | 2016-06-02 14:44:59 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-02 14:44:59 +0200 |
commit | 41c06c311b9c5642f6056d0b34030980ebf507b3 (patch) | |
tree | e7e367294c9acca47b97cd0ee58d0280f4c00318 | |
parent | a9fdf62b5797220b7736859a2bc0f34f96a7ed43 (diff) | |
download | gitlab-ce-41c06c311b9c5642f6056d0b34030980ebf507b3.tar.gz |
refactoring more things based on MR feedback
-rw-r--r-- | lib/gitlab/import_export/import_service.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/import_export/relation_factory.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/import_export/repo_restorer.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/import_export/shared.rb | 2 |
4 files changed, 13 insertions, 7 deletions
diff --git a/lib/gitlab/import_export/import_service.rb b/lib/gitlab/import_export/import_service.rb index 96cb8f4b174..db71f72efec 100644 --- a/lib/gitlab/import_export/import_service.rb +++ b/lib/gitlab/import_export/import_service.rb @@ -45,7 +45,8 @@ module Gitlab def wiki_restorer Gitlab::ImportExport::RepoRestorer.new(path_to_bundle: wiki_repo_path, shared: @shared, - project: ProjectWiki.new(project_tree.project)) + project: ProjectWiki.new(project_tree.project), + wiki: true) end def uploads_restorer diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb index 3738dbaebd3..dc86862c2d3 100644 --- a/lib/gitlab/import_export/relation_factory.rb +++ b/lib/gitlab/import_export/relation_factory.rb @@ -30,7 +30,7 @@ module Gitlab set_note_author if @relation_name == :notes update_user_references update_project_references - reset_tokens if @relation_name == 'Ci::Trigger' + reset_ci_tokens if @relation_name == 'Ci::Trigger' generate_imported_object end @@ -95,10 +95,10 @@ module Gitlab end end - def reset_tokens + def reset_ci_tokens return unless Gitlab::ImportExport.reset_tokens? - # If we import/export a project to the same instance, tokens will have to be reseated. + # If we import/export a project to the same instance, tokens will have to be reset. @relation_hash['token'] = nil end diff --git a/lib/gitlab/import_export/repo_restorer.rb b/lib/gitlab/import_export/repo_restorer.rb index 9fac58e2242..d6dcf5dc116 100644 --- a/lib/gitlab/import_export/repo_restorer.rb +++ b/lib/gitlab/import_export/repo_restorer.rb @@ -3,14 +3,15 @@ module Gitlab class RepoRestorer include Gitlab::ImportExport::CommandLineUtil - def initialize(project:, shared:, path_to_bundle:) + def initialize(project:, shared:, path_to_bundle:, wiki: false) @project = project @path_to_bundle = path_to_bundle @shared = shared + @wiki = wiki end 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) @@ -29,6 +30,10 @@ module Gitlab def path_to_repo @project.repository.path_to_repo end + + def wiki? + @wiki + end end end end diff --git a/lib/gitlab/import_export/shared.rb b/lib/gitlab/import_export/shared.rb index 01ac332981b..6aff05b886a 100644 --- a/lib/gitlab/import_export/shared.rb +++ b/lib/gitlab/import_export/shared.rb @@ -10,7 +10,7 @@ module Gitlab end 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 def error(error) |