Patchwork D1799: py3: use list() to get a list of items using dict.items()

login
register
mail settings
Submitter phabricator
Date Dec. 29, 2017, 12:50 a.m.
Message ID <differential-rev-PHID-DREV-n3u35wtrwn5iq2oyyu5p-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26496/
State Superseded
Headers show

Comments

phabricator - Dec. 29, 2017, 12:50 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  dict.items() on Python 3 returns a generator over the values of the dictionary,
  hence we can't delete elements while iterating over dict.items() in Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2443,7 +2443,7 @@ 
     modified = sorted(modifiedset)
     added = sorted(addedset)
     removed = sorted(removedset)
-    for dst, src in copy.items():
+    for dst, src in list(copy.items()):
         if src not in ctx1:
             # Files merged in during a merge and then copied/renamed are
             # reported as copies. We want to show them in the diff as additions.