From 80ed73689f89cb237fb74a78df15b5db4b1086c8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves David Date: Tue, 11 Oct 2016 02:15:23 +0200 Subject: [PATCH] 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 --- mercurial/copies.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mercurial/copies.py b/mercurial/copies.py index 973a00de9a..ce2b6d516e 100644 --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -333,7 +333,6 @@ def mergecopies(repo, c1, c2, ca): # see _checkcopies documentation below for these dicts copy1, copy2 = {}, {} - movewithdir1, movewithdir2 = {}, {} fullcopy1, fullcopy2 = {}, {} diverge = {} @@ -351,7 +350,6 @@ def mergecopies(repo, c1, c2, ca): _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 @@ def mergecopies(repo, c1, c2, ca): 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 @@ def mergecopies(repo, c1, c2, ca): 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: