Patchwork D6641: py3: source-transform only call-sites of iteritems(), not definitions

login
register
mail settings
Submitter phabricator
Date July 15, 2019, 2:14 p.m.
Message ID <bb6fcbf72eaf8e7cd6bb7dc13f2ab0ef@localhost.localdomain>
Download mbox | patch
Permalink /patch/40927/
State Not Applicable
Headers show

Comments

phabricator - July 15, 2019, 2:14 p.m.
Closed by commit rHG5a6ba3165736: py3: source-transform only call-sites of iteritems(), not definitions (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6641?vs=15900&id=15910

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6641/new/

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

AFFECTED FILES
  hgext/remotenames.py
  mercurial/__init__.py
  mercurial/branchmap.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -218,6 +218,8 @@ 
             self._verifybranch(k)
             yield k, v
 
+    items = iteritems
+
     def hasbranch(self, label):
         """ checks whether a branch of this name exists or not """
         self._verifybranch(label)
diff --git a/mercurial/__init__.py b/mercurial/__init__.py
--- a/mercurial/__init__.py
+++ b/mercurial/__init__.py
@@ -225,7 +225,9 @@ 
 
                 # It changes iteritems/values to items/values as they are not
                 # present in Python 3 world.
-                elif fn in ('iteritems', 'itervalues'):
+                elif (fn in ('iteritems', 'itervalues') and
+                      not (tokens[i - 1].type == token.NAME and
+                           tokens[i - 1].string == 'def')):
                     yield t._replace(string=fn[4:])
                     continue
 
diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -167,6 +167,8 @@ 
         for k, vtup in self.potentialentries.iteritems():
             yield (k, [bin(vtup[0])])
 
+    items = iteritems
+
 class remotenames(object):
     """
     This class encapsulates all the remotenames state. It also contains