comparison hgext/strip.py @ 43105:649d3ac37a12

py3: define and use pycompat.iteritems() for hgext/ .iteritems() -> .items() is the last source transform being performed. But it is also the most widely used. This commit adds a pycompat.iteritems symbol and imports it in place of .iteritems() for usage in hgext/. I chose to stop at just hgext/ because the patch will be large and it is an easy boundary to stop at since we can disable source transformation on a per-package basis. There are places where the type does implement items() and we could call items() directly. However, this would require critical thought and I thought it would be easier to just blindly change the code. We know which call sites need to be audited in the future because they have "pycompat.iteritems." With this change, we no longer perform source transformation on hgext! Differential Revision: https://phab.mercurial-scm.org/D7014
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 06 Oct 2019 19:25:18 -0400
parents c59eb1560c44
children 8ff1ecfadcd1
comparison
equal deleted inserted replaced
43104:74802979dd9d 43105:649d3ac37a12
204 204
205 # If the requested bookmark is not the only one pointing to a 205 # If the requested bookmark is not the only one pointing to a
206 # a revision we have to only delete the bookmark and not strip 206 # a revision we have to only delete the bookmark and not strip
207 # anything. revsets cannot detect that case. 207 # anything. revsets cannot detect that case.
208 nodetobookmarks = {} 208 nodetobookmarks = {}
209 for mark, node in repomarks.iteritems(): 209 for mark, node in pycompat.iteritems(repomarks):
210 nodetobookmarks.setdefault(node, []).append(mark) 210 nodetobookmarks.setdefault(node, []).append(mark)
211 for marks in nodetobookmarks.values(): 211 for marks in nodetobookmarks.values():
212 if bookmarks.issuperset(marks): 212 if bookmarks.issuperset(marks):
213 rsrevs = scmutil.bookmarkrevs(repo, marks[0]) 213 rsrevs = scmutil.bookmarkrevs(repo, marks[0])
214 revs.update(set(rsrevs)) 214 revs.update(set(rsrevs))