diff options
author | James Lopez <james@jameslopez.es> | 2016-06-14 13:47:07 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-14 13:47:07 +0300 |
commit | 3f7ed550110daaec8a76af7146b701dfc0210e60 (patch) | |
tree | 25fa93f0c306f8ea2ab9b28f26dfb11bb7551184 /app/services/projects | |
parent | 1ea44ee75077d67f3f24a288cc44d7c275ba8581 (diff) |
lots of refactoring to reuse import service
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/create_service.rb | 4 | ||||
-rw-r--r-- | app/services/projects/import_service.rb | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 61cac5419ad..7e467541539 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -52,9 +52,11 @@ module Projects save_project_and_import_data(import_data) + @project.import_url = download_export_namespace_project_path(@project.namespace, @project) if @project.gitlab_project_import? + @project.import_start if @project.import? - after_create_actions if @project.persisted? + after_create_actions if @project.persisted? && !@project.gitlab_project_import? if @project.errors.empty? @project.add_import_job if @project.import? diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index c4838d31f2f..b4b4c34b012 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -9,7 +9,8 @@ module Projects 'fogbugz', 'gitlab', 'github', - 'google_code' + 'google_code', + 'gitlab_project' ] def execute @@ -37,7 +38,7 @@ module Projects def import_repository begin - gitlab_shell.import_repository(project.path_with_namespace, project.import_url) + gitlab_shell.import_repository(project.path_with_namespace, project.import_url) unless @project.gitlab_project_import? rescue Gitlab::Shell::Error => e raise Error, "Error importing repository #{project.import_url} into #{project.path_with_namespace} - #{e.message}" end @@ -58,6 +59,8 @@ module Projects end def importer + return Gitlab::ImportExport::Importer if @project.gitlab_project_import? + class_name = "Gitlab::#{project.import_type.camelize}Import::Importer" class_name.constantize.new(project) end |