Patchwork D853: py3: explicitly convert dict.keys() and dict.items() into a list

login
register
mail settings
Submitter phabricator
Date Sept. 30, 2017, 1:19 p.m.
Message ID <4693fbaff57a38c0f3099cc44146e7be@localhost.localdomain>
Download mbox | patch
Permalink /patch/24259/
State Not Applicable
Headers show

Comments

phabricator - Sept. 30, 2017, 1:19 p.m.
pulkit updated this revision to Diff 2185.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D853?vs=2178&id=2185

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

AFFECTED FILES
  mercurial/copies.py
  mercurial/merge.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1029,7 +1029,7 @@ 
             # bids is a mapping from action method to list af actions
             # Consensus?
             if len(bids) == 1: # all bids are the same kind of method
-                m, l = bids.items()[0]
+                m, l = list(bids.items())[0]
                 if all(a == l[0] for a in l[1:]): # len(bids) is > 1
                     repo.ui.note(_(" %s: consensus for %s\n") % (f, m))
                     actions[f] = l[0]
@@ -1055,7 +1055,7 @@ 
                 for _f, args, msg in l:
                     repo.ui.note('  %s -> %s\n' % (msg, m))
             # Pick random action. TODO: Instead, prompt user when resolving
-            m, l = bids.items()[0]
+            m, l = list(bids.items())[0]
             repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') %
                          (f, m))
             actions[f] = l[0]
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -141,7 +141,7 @@ 
 def _dirstatecopies(d):
     ds = d._repo.dirstate
     c = ds.copies().copy()
-    for k in c.keys():
+    for k in list(c):
         if ds[k] not in 'anm':
             del c[k]
     return c
@@ -494,7 +494,7 @@ 
     renamedelete = {}
     renamedeleteset = set()
     divergeset = set()
-    for of, fl in diverge.items():
+    for of, fl in list(diverge.items()):
         if len(fl) == 1 or of in c1 or of in c2:
             del diverge[of] # not actually divergent, or not a rename
             if of not in c1 and of not in c2: