Skip to content
Snippets Groups Projects
Commit 1322c981 authored by James Lopez's avatar James Lopez
Browse files

create import data in service

parent 3dc64764
No related branches found
No related tags found
No related merge requests found
Loading
@@ -6,6 +6,7 @@ module Projects
Loading
@@ -6,6 +6,7 @@ module Projects
   
def execute def execute
forked_from_project_id = params.delete(:forked_from_project_id) forked_from_project_id = params.delete(:forked_from_project_id)
import_data = params.delete(:import_data)
   
@project = Project.new(params) @project = Project.new(params)
   
Loading
@@ -50,6 +51,7 @@ module Projects
Loading
@@ -50,6 +51,7 @@ module Projects
end end
   
Project.transaction do Project.transaction do
@project.create_or_update_import_data(data: import_data[:data], credentials: import_data[:credentials]) if import_data
@project.save @project.save
   
if @project.persisted? && !@project.import? if @project.persisted? && !@project.import?
Loading
Loading
Loading
@@ -11,7 +11,7 @@ module Gitlab
Loading
@@ -11,7 +11,7 @@ module Gitlab
end end
   
def execute def execute
project = ::Projects::CreateService.new( ::Projects::CreateService.new(
current_user, current_user,
name: repo["name"], name: repo["name"],
path: repo["slug"], path: repo["slug"],
Loading
@@ -21,11 +21,8 @@ module Gitlab
Loading
@@ -21,11 +21,8 @@ module Gitlab
import_type: "bitbucket", import_type: "bitbucket",
import_source: "#{repo["owner"]}/#{repo["slug"]}", import_source: "#{repo["owner"]}/#{repo["slug"]}",
import_url: "ssh://git@bitbucket.org/#{repo["owner"]}/#{repo["slug"]}.git", import_url: "ssh://git@bitbucket.org/#{repo["owner"]}/#{repo["slug"]}.git",
import_data: { credentials: { bb_session: session_data } }
).execute ).execute
project.create_or_update_import_data(credentials: { bb_session: session_data })
project
end end
end end
end end
Loading
Loading
Loading
@@ -12,7 +12,7 @@ module Gitlab
Loading
@@ -12,7 +12,7 @@ module Gitlab
end end
   
def execute def execute
project = ::Projects::CreateService.new( ::Projects::CreateService.new(
current_user, current_user,
name: repo.safe_name, name: repo.safe_name,
path: repo.path, path: repo.path,
Loading
@@ -21,12 +21,9 @@ module Gitlab
Loading
@@ -21,12 +21,9 @@ module Gitlab
visibility_level: Gitlab::VisibilityLevel::INTERNAL, visibility_level: Gitlab::VisibilityLevel::INTERNAL,
import_type: 'fogbugz', import_type: 'fogbugz',
import_source: repo.name, import_source: repo.name,
import_url: Project::UNKNOWN_IMPORT_URL import_url: Project::UNKNOWN_IMPORT_URL,
import_data: { data: { 'repo' => repo.raw_data, 'user_map' => user_map }, credentials: { fb_session: fb_session } }
).execute ).execute
project.create_or_update_import_data(data: { 'repo' => repo.raw_data, 'user_map' => user_map }, credentials: { fb_session: fb_session })
project
end end
end end
end end
Loading
Loading
Loading
@@ -11,7 +11,7 @@ module Gitlab
Loading
@@ -11,7 +11,7 @@ module Gitlab
end end
   
def execute def execute
project = ::Projects::CreateService.new( ::Projects::CreateService.new(
current_user, current_user,
name: repo.name, name: repo.name,
path: repo.name, path: repo.name,
Loading
@@ -21,12 +21,9 @@ module Gitlab
Loading
@@ -21,12 +21,9 @@ module Gitlab
visibility_level: Gitlab::VisibilityLevel::PUBLIC, visibility_level: Gitlab::VisibilityLevel::PUBLIC,
import_type: "google_code", import_type: "google_code",
import_source: repo.name, import_source: repo.name,
import_url: repo.import_url import_url: repo.import_url,
import_data: { data: { 'repo' => repo.raw_data, 'user_map' => user_map } }
).execute ).execute
project.create_or_update_import_data(data: { 'repo' => repo.raw_data, 'user_map' => user_map })
project
end end
end end
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment