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 ...@@ -11,15 +11,15 @@ class ProjectImportWorker
owner: current_user, owner: current_user,
namespace_id: namespace_id, namespace_id: namespace_id,
project_path: path) 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 def logger
# if result[:status] == :error Sidekiq.logger
# project.update(import_error: result[:message])
# project.import_fail
# return
# end
project.repository.after_import
project.import_finish
end end
end end
...@@ -14,7 +14,8 @@ module Gitlab ...@@ -14,7 +14,8 @@ module Gitlab
end end
def execute 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? project_tree.project if [restore_project_tree, restore_repo, restore_wiki_repo].all?
end end
...@@ -25,15 +26,20 @@ module Gitlab ...@@ -25,15 +26,20 @@ module Gitlab
end end
def project_tree 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 end
def restore_repo 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 end
def restore_wiki_repo 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 end
def storage_path def storage_path
......
...@@ -14,6 +14,8 @@ module Gitlab ...@@ -14,6 +14,8 @@ module Gitlab
@tree_hash = ActiveSupport::JSON.decode(json) @tree_hash = ActiveSupport::JSON.decode(json)
@project_members = @tree_hash.delete('project_members') @project_members = @tree_hash.delete('project_members')
create_relations create_relations
rescue
false
end end
def project def project
...@@ -50,7 +52,7 @@ module Gitlab ...@@ -50,7 +52,7 @@ module Gitlab
project_params: project_params, user: @user, namespace_id: @namespace_id) project_params: project_params, user: @user, namespace_id: @namespace_id)
project.path = @project_path project.path = @project_path
project.name = @project_path project.name = @project_path
project.save project.save!
project project
end 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