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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
78f23d3c
Commit
78f23d3c
authored
Jul 17, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify user lookups
parent
7b288105
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
lib/gitlab/bitbucket_server_import/importer.rb
lib/gitlab/bitbucket_server_import/importer.rb
+4
-5
No files found.
lib/gitlab/bitbucket_server_import/importer.rb
View file @
78f23d3c
...
...
@@ -46,7 +46,7 @@ module Gitlab
}.
to_json
)
end
def
gitlab_user_id
(
project
,
email
)
def
gitlab_user_id
(
email
)
find_user_id
(
email
)
||
project
.
creator_id
end
...
...
@@ -166,7 +166,7 @@ module Gitlab
target_branch_sha
=
pull_request
.
target_branch_sha
source_branch_sha
=
project
.
repository
.
commit
(
source_branch_sha
)
&
.
sha
||
source_branch_sha
target_branch_sha
=
project
.
repository
.
commit
(
target_branch_sha
)
&
.
sha
||
target_branch_sha
author_id
=
gitlab_user_id
(
p
roject
,
pull_request
.
author_email
)
||
User
.
ghost
.
id
author_id
=
gitlab_user_id
(
p
ull_request
.
author_email
)
project
.
merge_requests
.
find_by
(
iid:
pull_request
.
iid
)
&
.
destroy
...
...
@@ -207,8 +207,7 @@ module Gitlab
def
import_merge_event
(
merge_request
,
merge_event
)
committer
=
merge_event
.
committer_email
user_id
=
find_user_id
(
committer
)
if
committer
user_id
||=
User
.
ghost
.
id
user_id
=
gitlab_user_id
(
committer
)
timestamp
=
merge_event
.
merge_timestamp
metric
=
MergeRequest
::
Metrics
.
find_or_initialize_by
(
merge_request:
merge_request
)
metric
.
update
(
merged_by_id:
user_id
,
merged_at:
timestamp
)
...
...
@@ -277,7 +276,7 @@ module Gitlab
{
project:
project
,
note:
comment
.
note
,
author_id:
gitlab_user_id
(
project
,
comment
.
author_email
),
author_id:
gitlab_user_id
(
comment
.
author_email
),
created_at:
comment
.
created_at
,
updated_at:
comment
.
updated_at
}
...
...
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