Patchwork [5,of,6] py3: do not mutate dict while iterating in tagmerge

login
register
mail settings
Submitter Yuya Nishihara
Date March 4, 2018, 9:41 p.m.
Message ID <8267c6e887a9473e849f.1520199700@mimosa>
Download mbox | patch
Permalink /patch/29006/
State Accepted
Headers show

Comments

Yuya Nishihara - March 4, 2018, 9:41 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1520198026 18000
#      Sun Mar 04 16:13:46 2018 -0500
# Node ID 8267c6e887a9473e849faf2ac2ab439b9cbffcbf
# Parent  8fe5cf00bb5e51dadafa1811c9fc1aeb2fdb47d4
py3: do not mutate dict while iterating in tagmerge

Patch

diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -146,7 +146,7 @@  def writemergedtags(fcd, mergedtags):
     possible to the first parent's .hgtags file.
     '''
     # group the node-tag pairs that must be written next to each other
-    for tname, taglist in mergedtags.items():
+    for tname, taglist in list(mergedtags.items()):
         mergedtags[tname] = grouptagnodesbyline(taglist)
 
     # convert the grouped merged tags dict into a format that resembles the
@@ -269,4 +269,3 @@  def merge(repo, fcd, fco, fca):
     writemergedtags(fcd, mergedtags)
     ui.note(_('.hgtags merged successfully\n'))
     return False, 0
-