[Request] [+ ] D9592: copies: deal with the "same revision" special case earlier

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Dec 14 11:18:24 UTC 2020


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

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:



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20201214/f979db18/attachment-0001.html>


More information about the Mercurial-patches mailing list