changeset 42514:e7c55e24d6bf

copies: avoid reusing the same variable for two different copy dicts "childcopies" is initally the copies the current changeset to one of its children and then we reassign it with the copies from the start of the chain to the child. Let's use different names for these two things. Differential Revision: https://phab.mercurial-scm.org/D6564
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 19 Jun 2019 23:14:10 -0700
parents 15f04d652b62
children ebbbf25ae266
files mercurial/copies.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Fri Jun 21 09:33:57 2019 -0700
+++ b/mercurial/copies.py	Wed Jun 19 23:14:10 2019 -0700
@@ -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):