comparison mercurial/branchmap.py @ 42603:3018749a71bb

py3: source-transform only call-sites of iteritems(), not definitions branchmap.branchcache, among other classes, defines a iteritems(). That currently gets replaced by items() by the source transformer. That makes it harder for extensions to work with both py2 and py3, since they have to call either items() or iteritems() on branchcache. Let's not replace definitions of iteritems() (and itervalues()) and only replace the call-sites. We need to also add an items() alias to branchcache (etc) so our transformer call-sites will find it. Differential Revision: https://phab.mercurial-scm.org/D6641
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 12 Jul 2019 23:34:24 -0700
parents c7d236b55a3e
children 2372284d9457
comparison
equal deleted inserted replaced
42602:c7d236b55a3e 42603:3018749a71bb
215 215
216 def iteritems(self): 216 def iteritems(self):
217 for k, v in self._entries.iteritems(): 217 for k, v in self._entries.iteritems():
218 self._verifybranch(k) 218 self._verifybranch(k)
219 yield k, v 219 yield k, v
220
221 items = iteritems
220 222
221 def hasbranch(self, label): 223 def hasbranch(self, label):
222 """ checks whether a branch of this name exists or not """ 224 """ checks whether a branch of this name exists or not """
223 self._verifybranch(label) 225 self._verifybranch(label)
224 return label in self._entries 226 return label in self._entries