diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-31 09:37:54 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-31 09:37:54 +0300 |
commit | 3cda8c93d879282af2ab5b21ca2d89daf0238f17 (patch) | |
tree | 494ce2da69553ab6dfc41257bcc9feae3726fb42 /lib | |
parent | 7c88c4af0e31081b4137bc1b93e40d22ef6a93c6 (diff) |
Fix merge request SHA
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitbucket_server/representation/activity.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/bitbucket_server_import/importer.rb | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/bitbucket_server/representation/activity.rb b/lib/bitbucket_server/representation/activity.rb index a594b0881f6..08bf30a5d1e 100644 --- a/lib/bitbucket_server/representation/activity.rb +++ b/lib/bitbucket_server/representation/activity.rb @@ -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 diff --git a/lib/gitlab/bitbucket_server_import/importer.rb b/lib/gitlab/bitbucket_server_import/importer.rb index a96dd260221..d956968c013 100644 --- a/lib/gitlab/bitbucket_server_import/importer.rb +++ b/lib/gitlab/bitbucket_server_import/importer.rb @@ -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 |