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
3cda8c93
Commit
3cda8c93
authored
Jul 30, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix merge request SHA
parent
7c88c4af
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
lib/bitbucket_server/representation/activity.rb
lib/bitbucket_server/representation/activity.rb
+11
-3
lib/gitlab/bitbucket_server_import/importer.rb
lib/gitlab/bitbucket_server_import/importer.rb
+1
-1
spec/lib/bitbucket_server/representation/activity_spec.rb
spec/lib/bitbucket_server/representation/activity_spec.rb
+1
-0
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
+4
-1
No files found.
lib/bitbucket_server/representation/activity.rb
View file @
3cda8c93
...
...
@@ -28,25 +28,33 @@ module BitbucketServer
end
def
committer_user
raw
.
dig
(
'commit'
,
'committer'
,
'displayName'
)
commit
.
dig
(
'committer'
,
'displayName'
)
end
def
committer_email
raw
.
dig
(
'commit'
,
'committer'
,
'emailAddress'
)
commit
.
dig
(
'committer'
,
'emailAddress'
)
end
def
merge_timestamp
timestamp
=
raw
.
dig
(
'commit'
,
'committerTimestamp'
)
timestamp
=
commit
[
'committerTimestamp'
]
self
.
class
.
convert_timestamp
(
timestamp
)
end
def
merge_commit
commit
[
'id'
]
end
def
created_at
self
.
class
.
convert_timestamp
(
created_date
)
end
private
def
commit
raw
.
fetch
(
'commit'
,
{})
end
def
action
raw
[
'action'
]
end
...
...
lib/gitlab/bitbucket_server_import/importer.rb
View file @
3cda8c93
...
...
@@ -197,7 +197,6 @@ module Gitlab
updated_at:
pull_request
.
updated_at
}
attributes
[
:merge_commit_sha
]
=
target_branch_sha
if
pull_request
.
merged?
merge_request
=
project
.
merge_requests
.
create!
(
attributes
)
import_pull_request_comments
(
pull_request
,
merge_request
)
if
merge_request
.
persisted?
end
...
...
@@ -219,6 +218,7 @@ module Gitlab
user_id
=
gitlab_user_id
(
committer
)
timestamp
=
merge_event
.
merge_timestamp
merge_request
.
update_attributes
({
merge_commit_sha:
merge_event
.
merge_commit
})
metric
=
MergeRequest
::
Metrics
.
find_or_initialize_by
(
merge_request:
merge_request
)
metric
.
update
(
merged_by_id:
user_id
,
merged_at:
timestamp
)
end
...
...
spec/lib/bitbucket_server/representation/activity_spec.rb
View file @
3cda8c93
...
...
@@ -33,5 +33,6 @@ describe BitbucketServer::Representation::Activity do
it
{
expect
(
subject
.
committer_email
).
to
eq
(
'test.user@example.com'
)
}
it
{
expect
(
subject
.
merge_timestamp
).
to
be_a
(
Time
)
}
it
{
expect
(
subject
.
created_at
).
to
be_a
(
Time
)
}
it
{
expect
(
subject
.
merge_commit
).
to
eq
(
'839fa9a2d434eb697815b8fcafaecc51accfdbbc'
)
}
end
end
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
View file @
3cda8c93
...
...
@@ -65,7 +65,9 @@ describe Gitlab::BitbucketServerImport::Importer do
comment?:
false
,
merge_event?:
true
,
committer_email:
project
.
owner
.
email
,
merge_timestamp:
now
)
merge_timestamp:
now
,
merge_commit:
'12345678'
)
@pr_note
=
instance_double
(
BitbucketServer
::
Representation
::
Comment
,
...
...
@@ -90,6 +92,7 @@ describe Gitlab::BitbucketServerImport::Importer do
merge_request
=
MergeRequest
.
first
expect
(
merge_request
.
metrics
.
merged_by
).
to
eq
(
project
.
owner
)
expect
(
merge_request
.
metrics
.
merged_at
).
to
eq
(
@merge_event
.
merge_timestamp
)
expect
(
merge_request
.
merge_commit_sha
).
to
eq
(
'12345678'
)
end
it
'imports comments'
do
...
...
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