D6564: copies: avoid reusing the same variable for two different copy dicts

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Jun 22 10:26:03 EDT 2019


Closed by commit rHGe7c55e24d6bf: copies: avoid reusing the same variable for two different copy dicts (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6564?vs=15628&id=15632

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

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

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
@@ -312,15 +312,15 @@
                                if match(dst)}
             # Copy the dict only if later iterations will also need it
             if i != len(children[r]) - 1:
-                copies = copies.copy()
-            if childcopies:
-                childcopies = _chain(copies, childcopies)
+                newcopies = copies.copy()
             else:
-                childcopies = copies
+                newcopies = copies
+            if childcopies:
+                newcopies = _chain(newcopies, childcopies)
             for f in childctx.filesremoved():
-                if f in childcopies:
-                    del childcopies[f]
-            heapq.heappush(work, (c, parent, childcopies))
+                if f in newcopies:
+                    del newcopies[f]
+            heapq.heappush(work, (c, parent, newcopies))
     assert False
 
 def _forwardcopies(a, b, match=None):



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


More information about the Mercurial-devel mailing list