Commit 41c06c31 authored by James Lopez's avatar James Lopez

refactoring more things based on MR feedback

parent a9fdf62b
...@@ -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
......
...@@ -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 reseated. # If we import/export a project to the same instance, tokens will have to be reset.
@relation_hash['token'] = nil @relation_hash['token'] = nil
end end
......
...@@ -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
...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment