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

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Mon Dec 21 07:43:48 UTC 2020


baymax added a comment.
baymax updated this revision to Diff 24450.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9592?vs=24411&id=24450

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9592/new/

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
@@ -478,15 +478,19 @@
 
 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]:
+    # evacuate some simple case first:
+    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
-    # 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 major[1] == minor[1]:
+        return PICK_EITHER
+
+    # actual merging needed: content from "major" wins, unless it is older than
+    # the branch point or there is a merge
     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: pulkit, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201221/2e33b335/attachment-0002.html>


More information about the Mercurial-patches mailing list