[PATCH 1 of 4] checkcopies: move 'movewithdir' initialisation right before its usage
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sun Oct 16 14:47:20 UTC 2016
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1476144923 -7200
# Tue Oct 11 02:15:23 2016 +0200
# Node ID ea295754eb9a275b61a17e60aa4384dea2544d86
# Parent 0f0f99922ea75695d6044001aa82c31792386e9a
# EXP-Topic checkcopies
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
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- 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:
More information about the Mercurial-devel
mailing list