changeset 36165:53fe5a1a92bd

narrowmerge: iterate over a copy of dict items so we can mutate the dict Differential Revision: https://phab.mercurial-scm.org/D2238
author Augie Fackler <augie@google.com>
date Tue, 13 Feb 2018 13:37:43 -0500
parents c38e9248f531
children ccf7ae119769
files hgext/narrow/narrowmerge.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowmerge.py	Tue Feb 13 18:00:59 2018 -0500
+++ b/hgext/narrow/narrowmerge.py	Tue Feb 13 13:37:43 2018 -0500
@@ -28,7 +28,9 @@
         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: