diff options
author | James Lopez <james@jameslopez.es> | 2016-06-14 21:32:19 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-14 21:32:19 +0300 |
commit | b53ed84843b97c45bb19095cd2c7e0e8c86eb41a (patch) | |
tree | 3dbfeace867e212b6e3838421fcce02682abaa80 /app/services/projects | |
parent | 1d4243f5dd219d6e139864456353bee5f325bd72 (diff) |
adapted current services stuff to use new project import, plus fixes a few issues, updated routes, etc...
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/import_service.rb | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index b4b4c34b012..9159ec08959 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -14,22 +14,26 @@ module Projects ] def execute - if unknown_url? - # In this case, we only want to import issues, not a repository. - create_repository - else - import_repository - end + add_repository_to_project unless project.gitlab_project_import? import_data success - rescue Error => e + rescue => e error(e.message) end private + def add_repository_to_project + if unknown_url? + # In this case, we only want to import issues, not a repository. + create_repository + else + import_repository + end + end + def create_repository unless project.create_repository raise Error, 'The repository could not be created.' @@ -38,7 +42,7 @@ module Projects def import_repository begin - gitlab_shell.import_repository(project.path_with_namespace, project.import_url) unless @project.gitlab_project_import? + gitlab_shell.import_repository(project.path_with_namespace, project.import_url) rescue Gitlab::Shell::Error => e raise Error, "Error importing repository #{project.import_url} into #{project.path_with_namespace} - #{e.message}" end @@ -47,7 +51,7 @@ module Projects def import_data return unless has_importer? - project.repository.before_import + project.repository.before_import unless project.gitlab_project_import? unless importer.execute raise Error, 'The remote data could not be imported.' @@ -59,7 +63,7 @@ module Projects end def importer - return Gitlab::ImportExport::Importer if @project.gitlab_project_import? + return Gitlab::ImportExport::Importer.new(project) if @project.gitlab_project_import? class_name = "Gitlab::#{project.import_type.camelize}Import::Importer" class_name.constantize.new(project) |