D6277: copies: filter out copies from non-existent source later in _chain()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed May 1 22:14:14 EDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfdbeacb9d456: copies: filter out copies from non-existent source later in _chain() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6277?vs=14972&id=14984

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

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
@@ -134,13 +134,16 @@
             if t[v] != k:
                 # file wasn't renamed back to itself (i.e. case 4, not 3)
                 t[k] = t[v]
-        elif v in src:
-            # file is a copy of an existing file, i.e. case 6.
+        else:
+            # Renamed only in 'b', i.e. cases 5 & 6. We'll remove case 5 later.
             t[k] = v
 
     for k, v in list(t.items()):
+        # remove copies from files that didn't exist, i.e. case 5
+        if v not in src:
+            del t[k]
         # remove criss-crossed copies, i.e. case 3
-        if k in src and v in dst:
+        elif k in src and v in dst:
             del t[k]
         # remove copies to files that were then removed, i.e. case 1
         # and file 'y' in cases 3 & 4 (in case of rename)



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


More information about the Mercurial-devel mailing list