Patchwork D2238: narrowmerge: iterate over a copy of dict items so we can mutate the dict

login
register
mail settings
Submitter phabricator
Date Feb. 14, 2018, 5:05 a.m.
Message ID <9aee910cde30141884f86f805a66a8cd@localhost.localdomain>
Download mbox | patch
Permalink /patch/27868/
State Not Applicable
Headers show

Comments

phabricator - Feb. 14, 2018, 5:05 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG53fe5a1a92bd: narrowmerge: iterate over a copy of dict items so we can mutate the dict (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2238?vs=5660&id=5674

REVISION DETAIL
  https://phab.mercurial-scm.org/D2238

AFFECTED FILES
  hgext/narrow/narrowmerge.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

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 @@ 
         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: