D6344: copies: remove redundant filtering of ping-pong renames in _chain()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sun May 5 05:30:25 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We already handle the ping-pong rename case in the filtering step, so
  there's very little point in doing it in the chaining loop (ping-pong
  renames are very rare, so I'm not worried about the cost of adding it
  and then removing it again).

REPOSITORY
  rHG Mercurial

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

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
@@ -130,10 +130,8 @@
     t = a.copy()
     for k, v in b.iteritems():
         if v in t:
-            # found a chain, i.e. cases 3 & 4.
-            if t[v] != k:
-                # file wasn't renamed back to itself (i.e. case 4, not 3)
-                t[k] = t[v]
+            # Found a chain, i.e. cases 3 & 4. We'll remove case 3 later.
+            t[k] = t[v]
         else:
             # Renamed only in 'b', i.e. cases 5 & 6. We'll remove case 5 later.
             t[k] = v



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list