Patchwork D9592: copies: deal with the "same revision" special case earlier

login
register
mail settings
Submitter phabricator
Date Dec. 14, 2020, 11:18 a.m.
Message ID <differential-rev-PHID-DREV-akyiidzyf6te7socv3qu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47890/
State Superseded
Headers show

Comments

phabricator - Dec. 14, 2020, 11:18 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This can happens a lot in case of deletion so we better deal with it early.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9592

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -479,15 +479,17 @@ 
 
 def _compare_values(changes, isancestor, dest, minor, major):
     """compare two value within a _merge_copies_dict loop iteration"""
-    major_tt = major[0]
-    minor_tt = minor[0]
+    major_tt, major_value = major
+    minor_tt, minor_value = minor
 
-    if major[1] == minor[1]:
+    if major_tt == minor_tt:
+        # if it comes from the same revision it must be the same value
+        assert major_value == minor_value
+        return PICK_EITHER
+    elif major[1] == minor[1]:
         return PICK_EITHER
     # content from "major" wins, unless it is older
     # than the branch point or there is a merge
-    if major_tt == minor_tt:
-        return PICK_MAJOR
     elif changes is not None and major[1] is None and dest in changes.salvaged:
         return PICK_MINOR
     elif changes is not None and minor[1] is None and dest in changes.salvaged: