# HG changeset patch # User Pierre-Yves David # Date 2012-07-17 14:16:17 # Node ID ec80ae982689194745795e466970cd52c1470409 # Parent 5cd3e526ac37c0259cf5bf94b81402cdc2c6e792 _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 @@ class localrepository(object): # 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: