[PATCH 07 of 11 full-series] _updatebranchcache: prevent deleting dict key during iteration
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Jul 17 22:15:54 CDT 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1342534577 -7200
# Node ID 0221aaa35efd8f9f6258b11b60449ed121bead0b
# Parent faad247099c2fa1a6c0bdba6e2d34d361133fe6f
_updatebranchcache: prevent deleting dict key during iteration
We use dict.keys() to fetch all keys before starting to delete some. Otherwise
python complains that the dictionnary is altered during iteration.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -745,7 +745,7 @@
# branch that ceased to exist may not be in newbranches because
# newbranches is the set of candidate heads, which when you strip the
# last commit in a branch will be the parent branch.
- for branch in partial:
+ for branch in partial.keys():
nodes = [head for head in partial[branch]
if self.changelog.hasnode(head)]
if not nodes:
More information about the Mercurial-devel
mailing list