##// END OF EJS Templates
vcs: Use more specific merge error reason (either target or source ref missing)
Martin Bornhold -
r1080:1f73dd90 default
parent child Browse files
Show More
@@ -867,7 +867,7 b' class GitRepository(BaseRepository):'
867 867 except RepositoryError:
868 868 log.exception('Failure when doing local fetch on git shadow repo')
869 869 return MergeResponse(
870 False, False, None, MergeFailureReason.MISSING_COMMIT)
870 False, False, None, MergeFailureReason.MISSING_SOURCE_REF)
871 871
872 872 merge_ref = None
873 873 merge_failure_reason = MergeFailureReason.NONE
@@ -673,11 +673,16 b' class MercurialRepository(BaseRepository'
673 673 return MergeResponse(
674 674 False, False, None, MergeFailureReason.TARGET_IS_NOT_HEAD)
675 675
676 if (target_ref.type == 'branch' and
677 len(self._heads(target_ref.name)) != 1):
676 try:
677 if (target_ref.type == 'branch' and
678 len(self._heads(target_ref.name)) != 1):
679 return MergeResponse(
680 False, False, None,
681 MergeFailureReason.HG_TARGET_HAS_MULTIPLE_HEADS)
682 except CommitDoesNotExistError as e:
683 log.exception('Failure when looking up branch heads on hg target')
678 684 return MergeResponse(
679 False, False, None,
680 MergeFailureReason.HG_TARGET_HAS_MULTIPLE_HEADS)
685 False, False, None, MergeFailureReason.MISSING_TARGET_REF)
681 686
682 687 shadow_repo = self._get_shadow_instance(shadow_repository_path)
683 688
@@ -691,7 +696,7 b' class MercurialRepository(BaseRepository'
691 696 except CommitDoesNotExistError:
692 697 log.exception('Failure when doing local pull on hg shadow repo')
693 698 return MergeResponse(
694 False, False, None, MergeFailureReason.MISSING_COMMIT)
699 False, False, None, MergeFailureReason.MISSING_SOURCE_REF)
695 700
696 701 merge_ref = None
697 702 merge_failure_reason = MergeFailureReason.NONE
@@ -401,10 +401,10 b' class TestRepositoryMerge:'
401 401
402 402 assert merge_response == expected_merge_response
403 403
404 def test_merge_missing_commit(self, vcsbackend):
404 def test_merge_missing_source_reference(self, vcsbackend):
405 405 self.prepare_for_success(vcsbackend)
406 406 expected_merge_response = MergeResponse(
407 False, False, None, MergeFailureReason.MISSING_COMMIT)
407 False, False, None, MergeFailureReason.MISSING_SOURCE_REF)
408 408
409 409 source_ref = Reference(
410 410 self.source_ref.type, 'not_existing', self.source_ref.commit_id)
General Comments 0
You need to be logged in to leave comments. Login now