Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
a1a1d1f7
Commit
a1a1d1f7
authored
Apr 07, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored create_or_update_import_data
parent
15044e7d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
19 deletions
+10
-19
app/models/project.rb
app/models/project.rb
+7
-16
lib/gitlab/bitbucket_import/project_creator.rb
lib/gitlab/bitbucket_import/project_creator.rb
+1
-1
lib/gitlab/fogbugz_import/project_creator.rb
lib/gitlab/fogbugz_import/project_creator.rb
+1
-1
lib/gitlab/google_code_import/project_creator.rb
lib/gitlab/google_code_import/project_creator.rb
+1
-1
No files found.
app/models/project.rb
View file @
a1a1d1f7
...
...
@@ -404,7 +404,7 @@ class Project < ActiveRecord::Base
def
import_url
=
(
value
)
import_url
=
Gitlab
::
ImportUrl
.
new
(
value
)
create_or_update_import_data
(
import_url
.
credentials
)
create_or_update_import_data
(
credentials:
import_url
.
credentials
)
super
(
import_url
.
sanitized_url
)
end
...
...
@@ -417,26 +417,17 @@ class Project < ActiveRecord::Base
end
end
def
create_or_update_import_data
(
credentials
)
def
create_or_update_import_data
(
data:
nil
,
credentials:
nil
)
project_import_data
=
import_data
||
build_import_data
project_import_data
.
data
=
data
if
data
if
credentials
project_import_data
.
credentials
||=
{}
project_import_data
.
credentials
=
project_import_data
.
credentials
.
merge
(
credentials
)
project_import_data
.
save
end
def
create_or_update_import_data
(
credentials
)
project_import_data
=
import_data
||
build_import_data
project_import_data
.
credentials
||=
{}
project_import_data
.
credentials
=
project_import_data
.
credentials
.
merge
(
credentials
)
project_import_data
.
save
end
def
update_import_data
(
data:
nil
,
credentials:
nil
)
import_data
.
data
=
data
if
data
import_data
.
credentials
=
import_data
.
credentials
.
merge
(
credentials
)
if
credentials
import_data
.
save
end
def
import?
external_import?
||
forked?
end
...
...
lib/gitlab/bitbucket_import/project_creator.rb
View file @
a1a1d1f7
...
...
@@ -23,7 +23,7 @@ module Gitlab
import_url:
"ssh://git@bitbucket.org/
#{
repo
[
"owner"
]
}
/
#{
repo
[
"slug"
]
}
.git"
,
).
execute
project
.
update_import_data
(
credentials:
{
bb_session:
session_data
})
project
.
create_or_
update_import_data
(
credentials:
{
bb_session:
session_data
})
project
end
...
...
lib/gitlab/fogbugz_import/project_creator.rb
View file @
a1a1d1f7
...
...
@@ -24,7 +24,7 @@ module Gitlab
import_url:
Project
::
UNKNOWN_IMPORT_URL
).
execute
project
.
update_import_data
(
data:
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
},
credentials:
{
fb_session:
fb_session
})
project
.
create_or_
update_import_data
(
data:
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
},
credentials:
{
fb_session:
fb_session
})
project
end
...
...
lib/gitlab/google_code_import/project_creator.rb
View file @
a1a1d1f7
...
...
@@ -24,7 +24,7 @@ module Gitlab
import_url:
repo
.
import_url
).
execute
project
.
update_import_data
(
data:
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
})
project
.
create_or_
update_import_data
(
data:
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
})
project
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment