# HG changeset patch # User Augie Fackler # Date 2018-02-13 18:37:43 # Node ID 53fe5a1a92bd693ae425dc811050f66d5ff888f9 # Parent c38e9248f5312384c541c260d65c108101039317 narrowmerge: iterate over a copy of dict items so we can mutate the dict Differential Revision: https://phab.mercurial-scm.org/D2238 diff --git a/hgext/narrow/narrowmerge.py b/hgext/narrow/narrowmerge.py --- a/hgext/narrow/narrowmerge.py +++ b/hgext/narrow/narrowmerge.py @@ -28,7 +28,9 @@ def setup(): nooptypes = set(['k']) # TODO: handle with nonconflicttypes nonconflicttypes = set('a am c cm f g r e'.split()) narrowmatch = repo.narrowmatch() - for f, action in actions.items(): + # We mutate the items in the dict during iteration, so iterate + # over a copy. + for f, action in list(actions.items()): if narrowmatch(f): pass elif not branchmerge: