[Commented On] D9585: copies: properly match result during changeset centric copy tracing

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Thu Dec 17 20:53:49 UTC 2020


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


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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9585?vs=24249&id=24362

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies-chain-merge.t

CHANGE DETAILS

diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t
--- a/tests/test-copies-chain-merge.t
+++ b/tests/test-copies-chain-merge.t
@@ -872,6 +872,19 @@
 Test copy information chaining
 ==============================
 
+Check that matching only affect the destination and not intermediate path
+-------------------------------------------------------------------------
+
+The two status call should give the same value for f
+
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("a-2")'
+  A f
+    a
+  R a
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("a-2")' f
+  A f
+    a (no-changeset no-compatibility !)
+
 merging with unrelated change does not interfere with the renames
 ---------------------------------------------------------------
 
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -196,9 +196,7 @@
 
     changelogrevision = cl.changelogrevision
 
-    alwaysmatch = match.always()
-
-    if rustmod is not None and alwaysmatch:
+    if rustmod is not None:
 
         def revinfo(rev):
             p1, p2 = parents(rev)
@@ -356,7 +354,7 @@
 
     alwaysmatch = match.always()
 
-    if rustmod is not None and alwaysmatch:
+    if rustmod is not None:
         final_copies = rustmod.combine_changeset_copies(
             list(revs), children_count, targetrev, revinfo, isancestor
         )
@@ -396,12 +394,6 @@
                     elif parent == 2:
                         childcopies = changes.copied_from_p2
 
-                    if not alwaysmatch:
-                        childcopies = {
-                            dst: src
-                            for dst, src in childcopies.items()
-                            if match(dst)
-                        }
                     if childcopies:
                         newcopies = copies.copy()
                         for dest, source in pycompat.iteritems(childcopies):
@@ -447,6 +439,10 @@
         for dest, (tt, source) in all_copies[targetrev].items():
             if source is not None:
                 final_copies[dest] = source
+    if not alwaysmatch:
+        for filename in list(final_copies.keys()):
+            if not match(filename):
+                del final_copies[filename]
     return final_copies
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201217/4d0eb86a/attachment-0002.html>


More information about the Mercurial-patches mailing list