diff options
author | James Lopez <james@jameslopez.es> | 2016-03-23 17:57:10 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-03-23 17:57:10 +0100 |
commit | cc4d04f97f891479c4d033196c6868e19528c51c (patch) | |
tree | a81915e9733d467e011be0befca017327d5f93c8 /lib | |
parent | 6967871fc567cbadd63f26f1ef87c4008cc6387b (diff) | |
download | gitlab-ce-cc4d04f97f891479c4d033196c6868e19528c51c.tar.gz |
added rest of importers, fixed specs and some issues with the migration
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/google_code_import/importer.rb | 20 | ||||
-rw-r--r-- | lib/gitlab/google_code_import/project_creator.rb | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/gitlab/google_code_import/importer.rb b/lib/gitlab/google_code_import/importer.rb index 62da327931f..6b0715d1492 100644 --- a/lib/gitlab/google_code_import/importer.rb +++ b/lib/gitlab/google_code_import/importer.rb @@ -6,12 +6,13 @@ module Gitlab def initialize(project) @project = project - import_data = project.import_data.try(:data) - repo_data = import_data["repo"] if import_data - @repo = GoogleCodeImport::Repository.new(repo_data) - - @closed_statuses = [] - @known_labels = Set.new + if import_data_credentials && import_data_credentials['repo'] + @repo = GoogleCodeImport::Repository.new(import_data_credentials['repo']) + @closed_statuses = [] + @known_labels = Set.new + else + raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}" + end end def execute @@ -28,6 +29,10 @@ module Gitlab private + def import_data_credentials + @import_data_credentials ||= project.import_data.credentials if project.import_data + end + def user_map @user_map ||= begin user_map = Hash.new do |hash, user| @@ -35,8 +40,7 @@ module Gitlab Client.mask_email(user).sub("...", "\\.\\.\\.") end - import_data = project.import_data.try(:data) - stored_user_map = import_data["user_map"] if import_data + stored_user_map = import_data_credentials["user_map"] user_map.update(stored_user_map) if stored_user_map user_map diff --git a/lib/gitlab/google_code_import/project_creator.rb b/lib/gitlab/google_code_import/project_creator.rb index 87821c23460..acd3a832d59 100644 --- a/lib/gitlab/google_code_import/project_creator.rb +++ b/lib/gitlab/google_code_import/project_creator.rb @@ -25,7 +25,7 @@ module Gitlab ).execute project.create_import_data( - data: { + credentials: { "repo" => repo.raw_data, "user_map" => user_map } |