##// 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 except RepositoryError:
867 except RepositoryError:
868 log.exception('Failure when doing local fetch on git shadow repo')
868 log.exception('Failure when doing local fetch on git shadow repo')
869 return MergeResponse(
869 return MergeResponse(
870 False, False, None, MergeFailureReason.MISSING_COMMIT)
870 False, False, None, MergeFailureReason.MISSING_SOURCE_REF)
871
871
872 merge_ref = None
872 merge_ref = None
873 merge_failure_reason = MergeFailureReason.NONE
873 merge_failure_reason = MergeFailureReason.NONE
@@ -673,11 +673,16 b' class MercurialRepository(BaseRepository'
673 return MergeResponse(
673 return MergeResponse(
674 False, False, None, MergeFailureReason.TARGET_IS_NOT_HEAD)
674 False, False, None, MergeFailureReason.TARGET_IS_NOT_HEAD)
675
675
676 if (target_ref.type == 'branch' and
676 try:
677 len(self._heads(target_ref.name)) != 1):
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 return MergeResponse(
684 return MergeResponse(
679 False, False, None,
685 False, False, None, MergeFailureReason.MISSING_TARGET_REF)
680 MergeFailureReason.HG_TARGET_HAS_MULTIPLE_HEADS)
681
686
682 shadow_repo = self._get_shadow_instance(shadow_repository_path)
687 shadow_repo = self._get_shadow_instance(shadow_repository_path)
683
688
@@ -691,7 +696,7 b' class MercurialRepository(BaseRepository'
691 except CommitDoesNotExistError:
696 except CommitDoesNotExistError:
692 log.exception('Failure when doing local pull on hg shadow repo')
697 log.exception('Failure when doing local pull on hg shadow repo')
693 return MergeResponse(
698 return MergeResponse(
694 False, False, None, MergeFailureReason.MISSING_COMMIT)
699 False, False, None, MergeFailureReason.MISSING_SOURCE_REF)
695
700
696 merge_ref = None
701 merge_ref = None
697 merge_failure_reason = MergeFailureReason.NONE
702 merge_failure_reason = MergeFailureReason.NONE
@@ -401,10 +401,10 b' class TestRepositoryMerge:'
401
401
402 assert merge_response == expected_merge_response
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 self.prepare_for_success(vcsbackend)
405 self.prepare_for_success(vcsbackend)
406 expected_merge_response = MergeResponse(
406 expected_merge_response = MergeResponse(
407 False, False, None, MergeFailureReason.MISSING_COMMIT)
407 False, False, None, MergeFailureReason.MISSING_SOURCE_REF)
408
408
409 source_ref = Reference(
409 source_ref = Reference(
410 self.source_ref.type, 'not_existing', self.source_ref.commit_id)
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