changeset 36316:759579bac31d

merge: make a copy of dict.items() before mutating the dict during iteration Differential Revision: https://phab.mercurial-scm.org/D2344
author Augie Fackler <augie@google.com>
date Sun, 18 Feb 2018 14:53:55 -0500
parents 398e96f77aa3
children f14879f61cd8
files mercurial/merge.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Sun Feb 18 14:53:31 2018 -0500
+++ b/mercurial/merge.py	Sun Feb 18 14:53:55 2018 -0500
@@ -1185,8 +1185,9 @@
 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
     """Resolves false conflicts where the nodeid changed but the content
        remained the same."""
-
-    for f, (m, args, msg) in actions.items():
+    # We force a copy of actions.items() because we're going to mutate
+    # actions as we resolve trivial conflicts.
+    for f, (m, args, msg) in list(actions.items()):
         if m == 'cd' and f in ancestor and not wctx[f].cmp(ancestor[f]):
             # local did change but ended up with same content
             actions[f] = 'r', None, "prompt same"