Commit 63df9b57 authored by James Lopez's avatar James Lopez

Merge branches 'feature/project-export-ui-experimental' and...

Merge branches 'feature/project-export-ui-experimental' and 'feature/project-import' of gitlab.com:gitlab-org/gitlab-ce into feature/project-export-ui-experimental
parents 2a135866 9f5dd2de
......@@ -11,15 +11,15 @@ class ProjectImportWorker
owner: current_user,
namespace_id: namespace_id,
project_path: path)
if project
project.repository.after_import
project.import_finish
else
logger.error("There was an error during the import: #{tmpfile}")
end
end
# TODO: Move this to import service
# if result[:status] == :error
# project.update(import_error: result[:message])
# project.import_fail
# return
# end
project.repository.after_import
project.import_finish
def logger
Sidekiq.logger
end
end
......@@ -14,7 +14,8 @@ module Gitlab
end
def execute
Gitlab::ImportExport::Importer.import(archive_file: @archive_file, storage_path: storage_path)
Gitlab::ImportExport::Importer.import(archive_file: @archive_file,
storage_path: storage_path)
project_tree.project if [restore_project_tree, restore_repo, restore_wiki_repo].all?
end
......@@ -25,15 +26,20 @@ module Gitlab
end
def project_tree
@project_tree ||= Gitlab::ImportExport::ProjectTreeRestorer.new(path: storage_path, user: @current_user, project_path: @project_path, namespace_id: @namespace.id)
@project_tree ||= Gitlab::ImportExport::ProjectTreeRestorer.new(path: storage_path,
user: @current_user,
project_path: @project_path,
namespace_id: @namespace.id)
end
def restore_repo
Gitlab::ImportExport::RepoRestorer.new(path_to_bundle: repo_path, project: project_tree.project).restore
Gitlab::ImportExport::RepoRestorer.new(path_to_bundle: repo_path,
project: project_tree.project).restore
end
def restore_wiki_repo
Gitlab::ImportExport::RepoRestorer.new(path_to_bundle: wiki_repo_path, project: ProjectWiki.new(project_tree.project)).restore
Gitlab::ImportExport::RepoRestorer.new(path_to_bundle: wiki_repo_path,
project: ProjectWiki.new(project_tree.project)).restore
end
def storage_path
......
......@@ -14,6 +14,8 @@ module Gitlab
@tree_hash = ActiveSupport::JSON.decode(json)
@project_members = @tree_hash.delete('project_members')
create_relations
rescue
false
end
def project
......@@ -50,7 +52,7 @@ module Gitlab
project_params: project_params, user: @user, namespace_id: @namespace_id)
project.path = @project_path
project.name = @project_path
project.save
project.save!
project
end
......
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