changeset 30183:0106f93ca1d5

checkcopies: move 'movewithdir' initialisation right before its usage The 'movewithdir' had a lot of related logic all around the 'mergecopies'. However it is actually never containing anything until the very last loop in that function. We move the (simplified) variable definition there for clarity
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 11 Oct 2016 02:15:23 +0200
parents 144d8fe266d9
children 7321c6b0c9fd
files mercurial/copies.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Fri Oct 14 01:53:15 2016 +0200
+++ b/mercurial/copies.py	Tue Oct 11 02:15:23 2016 +0200
@@ -333,7 +333,6 @@
 
     # see _checkcopies documentation below for these dicts
     copy1, copy2 = {}, {}
-    movewithdir1, movewithdir2 = {}, {}
     fullcopy1, fullcopy2 = {}, {}
     diverge = {}
 
@@ -351,7 +350,6 @@
         _checkcopies(c2, f, m2, m1, ca, limit, diverge, copy2, fullcopy2)
 
     copy = dict(copy1.items() + copy2.items())
-    movewithdir = dict(movewithdir1.items() + movewithdir2.items())
     fullcopy = dict(fullcopy1.items() + fullcopy2.items())
 
     renamedelete = {}
@@ -395,7 +393,7 @@
     del divergeset
 
     if not fullcopy:
-        return copy, movewithdir, diverge, renamedelete
+        return copy, {}, diverge, renamedelete
 
     repo.ui.debug("  checking for directory renames\n")
 
@@ -433,12 +431,13 @@
     del d1, d2, invalid
 
     if not dirmove:
-        return copy, movewithdir, diverge, renamedelete
+        return copy, {}, diverge, renamedelete
 
     for d in dirmove:
         repo.ui.debug("   discovered dir src: '%s' -> dst: '%s'\n" %
                       (d, dirmove[d]))
 
+    movewithdir = {}
     # check unaccounted nonoverlapping files against directory moves
     for f in u1r + u2r:
         if f not in fullcopy: