comparison mercurial/localrepo.py @ 17210:ec80ae982689

_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.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 17 Jul 2012 16:16:17 +0200
parents 8018f2340807
children 6ffb35b2284c
comparison
equal deleted inserted replaced
17209:5cd3e526ac37 17210:ec80ae982689
743 # There may be branches that cease to exist when the last commit in the 743 # There may be branches that cease to exist when the last commit in the
744 # branch was stripped. This code filters them out. Note that the 744 # branch was stripped. This code filters them out. Note that the
745 # branch that ceased to exist may not be in newbranches because 745 # branch that ceased to exist may not be in newbranches because
746 # newbranches is the set of candidate heads, which when you strip the 746 # newbranches is the set of candidate heads, which when you strip the
747 # last commit in a branch will be the parent branch. 747 # last commit in a branch will be the parent branch.
748 for branch in partial: 748 for branch in partial.keys():
749 nodes = [head for head in partial[branch] 749 nodes = [head for head in partial[branch]
750 if self.changelog.hasnode(head)] 750 if self.changelog.hasnode(head)]
751 if not nodes: 751 if not nodes:
752 del partial[branch] 752 del partial[branch]
753 753