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
Jérome Perrin
gitlab-ce
Commits
b0501c34
Commit
b0501c34
authored
Dec 16, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BB importer: address review comment
parent
3b4e81ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
doc/workflow/importing/import_projects_from_bitbucket.md
doc/workflow/importing/import_projects_from_bitbucket.md
+1
-1
lib/gitlab/bitbucket_import/importer.rb
lib/gitlab/bitbucket_import/importer.rb
+4
-6
No files found.
doc/workflow/importing/import_projects_from_bitbucket.md
View file @
b0501c34
...
@@ -20,7 +20,7 @@ It takes just a few steps to import your existing Bitbucket projects to GitLab.
...
@@ -20,7 +20,7 @@ It takes just a few steps to import your existing Bitbucket projects to GitLab.
![
Import projects
](
bitbucket_importer/bitbucket_import_select_project.png
)
![
Import projects
](
bitbucket_importer/bitbucket_import_select_project.png
)
A new GitLab project will be created with your imported data. Keep in mind that if you want
to
Bitbucket users
A new GitLab project will be created with your imported data. Keep in mind that if you want Bitbucket users
to be linked to GitLab user you have to have all of them in GitLab in advance. They will be matched by their BitBucket username.
to be linked to GitLab user you have to have all of them in GitLab in advance. They will be matched by their BitBucket username.
### Note
### Note
...
...
lib/gitlab/bitbucket_import/importer.rb
View file @
b0501c34
...
@@ -28,6 +28,7 @@ module Gitlab
...
@@ -28,6 +28,7 @@ module Gitlab
def
handle_errors
def
handle_errors
return
unless
errors
.
any?
return
unless
errors
.
any?
project
.
update_column
(
:import_error
,
{
project
.
update_column
(
:import_error
,
{
message:
'The remote data could not be fully imported.'
,
message:
'The remote data could not be fully imported.'
,
errors:
errors
errors:
errors
...
@@ -35,15 +36,12 @@ module Gitlab
...
@@ -35,15 +36,12 @@ module Gitlab
end
end
def
gitlab_user_id
(
project
,
username
)
def
gitlab_user_id
(
project
,
username
)
if
username
user
=
find_user
(
username
)
user
=
find_user
(
username
)
user
.
try
(
:id
)
||
project
.
creator_id
(
user
&&
user
.
id
)
||
project
.
creator_id
else
project
.
creator_id
end
end
end
def
find_user
(
username
)
def
find_user
(
username
)
return
nil
unless
username
User
.
joins
(
:identities
).
find_by
(
"identities.extern_uid = ? AND identities.provider = 'bitbucket'"
,
username
)
User
.
joins
(
:identities
).
find_by
(
"identities.extern_uid = ? AND identities.provider = 'bitbucket'"
,
username
)
end
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