Show More
@@ -80,7 +80,7 b' def trigger_log_create_pull_request_hook' | |||
|
80 | 80 | extras = _get_rc_scm_extras(username, repo_name, repo_alias, |
|
81 | 81 | 'create_pull_request') |
|
82 | 82 | events.trigger(events.PullRequestCreateEvent(pull_request)) |
|
83 | extras.update(pull_request.get_api_data()) | |
|
83 | extras.update(pull_request.get_api_data(with_merge_state=False)) | |
|
84 | 84 | hooks_base.log_create_pull_request(**extras) |
|
85 | 85 | |
|
86 | 86 |
@@ -161,7 +161,7 b' class MergeResponse(object):' | |||
|
161 | 161 | u'This pull request cannot be merged because the source contains ' |
|
162 | 162 | u'more branches than the target.'), |
|
163 | 163 | MergeFailureReason.HG_TARGET_HAS_MULTIPLE_HEADS: lazy_ugettext( |
|
164 | u'This pull request cannot be merged because the target ' | |
|
164 | u'This pull request cannot be merged because the target `{target_ref.name}` ' | |
|
165 | 165 | u'has multiple heads: `{heads}`.'), |
|
166 | 166 | MergeFailureReason.TARGET_IS_LOCKED: lazy_ugettext( |
|
167 | 167 | u'This pull request cannot be merged because the target repository is ' |
@@ -309,6 +309,9 b' class BaseRepository(object):' | |||
|
309 | 309 | def _remote(self): |
|
310 | 310 | raise NotImplementedError |
|
311 | 311 | |
|
312 | def _heads(self, branch=None): | |
|
313 | return [] | |
|
314 | ||
|
312 | 315 | @LazyProperty |
|
313 | 316 | def EMPTY_COMMIT(self): |
|
314 | 317 | return EmptyCommit(self.EMPTY_COMMIT_ID) |
@@ -715,11 +715,16 b' class MercurialRepository(BaseRepository' | |||
|
715 | 715 | |
|
716 | 716 | try: |
|
717 | 717 | if target_ref.type == 'branch' and len(self._heads(target_ref.name)) != 1: |
|
718 | heads = ','.join(self._heads(target_ref.name)) | |
|
718 | heads = '\n,'.join(self._heads(target_ref.name)) | |
|
719 | metadata = { | |
|
720 | 'target_ref': target_ref, | |
|
721 | 'source_ref': source_ref, | |
|
722 | 'heads': heads | |
|
723 | } | |
|
719 | 724 | return MergeResponse( |
|
720 | 725 | False, False, None, |
|
721 | 726 | MergeFailureReason.HG_TARGET_HAS_MULTIPLE_HEADS, |
|
722 |
metadata= |
|
|
727 | metadata=metadata) | |
|
723 | 728 | except CommitDoesNotExistError: |
|
724 | 729 | log.exception('Failure when looking up branch heads on hg target') |
|
725 | 730 | return MergeResponse( |
@@ -1317,8 +1317,16 b' class PullRequestModel(BaseModel):' | |||
|
1317 | 1317 | possible = pull_request.last_merge_status == MergeFailureReason.NONE |
|
1318 | 1318 | metadata = { |
|
1319 | 1319 | 'target_ref': pull_request.target_ref_parts, |
|
1320 | 'source_ref': pull_request.source_ref_parts | |
|
1320 | 'source_ref': pull_request.source_ref_parts, | |
|
1321 | 1321 | } |
|
1322 | if not possible and target_ref.type == 'branch': | |
|
1323 | # NOTE(marcink): case for mercurial multiple heads on branch | |
|
1324 | heads = target_vcs._heads(target_ref.name) | |
|
1325 | if len(heads) != 1: | |
|
1326 | heads = '\n,'.join(target_vcs._heads(target_ref.name)) | |
|
1327 | metadata.update({ | |
|
1328 | 'heads': heads | |
|
1329 | }) | |
|
1322 | 1330 | merge_state = MergeResponse( |
|
1323 | 1331 | possible, False, None, pull_request.last_merge_status, metadata=metadata) |
|
1324 | 1332 |
@@ -512,7 +512,7 b' def test_outdated_comments(' | |||
|
512 | 512 | (MergeFailureReason.HG_SOURCE_HAS_MORE_BRANCHES, |
|
513 | 513 | 'This pull request cannot be merged because the source contains more branches than the target.'), |
|
514 | 514 | (MergeFailureReason.HG_TARGET_HAS_MULTIPLE_HEADS, |
|
515 | 'This pull request cannot be merged because the target has multiple heads: `a,b,c`.'), | |
|
515 | 'This pull request cannot be merged because the target `ref_name` has multiple heads: `a,b,c`.'), | |
|
516 | 516 | (MergeFailureReason.TARGET_IS_LOCKED, |
|
517 | 517 | 'This pull request cannot be merged because the target repository is locked by user:123.'), |
|
518 | 518 | (MergeFailureReason.MISSING_TARGET_REF, |
General Comments 0
You need to be logged in to leave comments.
Login now