From patchwork Mon Feb 19 02:06:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D2344: merge: make a copy of dict.items() before mutating the dict during iteration From: phabricator X-Patchwork-Id: 28144 Message-Id: <7a8670db956129fc997f6d6aa056d68e@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Mon, 19 Feb 2018 02:06:58 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHGc44c5ecc2565: merge: make a copy of dict.items() before mutating the dict during iteration (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2344?vs=5901&id=5912 REVISION DETAIL https://phab.mercurial-scm.org/D2344 AFFECTED FILES mercurial/merge.py CHANGE DETAILS To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -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"