Mercurial > public > mercurial-scm > hg
diff mercurial/phases.py @ 48913:f254fc73d956
global: bulk replace simple pycompat.iteritems(x) with x.items()
pycompat.iteritems() just calls .items().
This commit applies a regular expression search and replace to convert
simple instances of pycompat.iteritems() with .items(). There are still
a handful of calls to pycompat.iteritems() remaining. But these all have
more complicated expressions that I wasn't comfortable performing an
automated replace on. In addition, some simple replacements were withheld
because they broke pytype. These will be handled by their own changesets.
Differential Revision: https://phab.mercurial-scm.org/D12318
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 03 Mar 2022 18:28:30 -0800 |
parents | 6000f5b25c9b |
children | 642e31cb55f0 |
line wrap: on
line diff
--- a/mercurial/phases.py Thu Mar 03 17:39:20 2022 -0800 +++ b/mercurial/phases.py Thu Mar 03 18:28:30 2022 -0800 @@ -219,7 +219,7 @@ The revision lists are encoded as (phase, root) pairs. """ binarydata = [] - for phase, nodes in pycompat.iteritems(phasemapping): + for phase, nodes in phasemapping.items(): for head in nodes: binarydata.append(_fphasesentry.pack(phase, head)) return b''.join(binarydata) @@ -363,9 +363,7 @@ self.invalidate() self.loadphaserevs(repo) return any( - revs - for phase, revs in pycompat.iteritems(self.phaseroots) - if phase != public + revs for phase, revs in self.phaseroots.items() if phase != public ) def nonpublicphaseroots(self, repo): @@ -383,7 +381,7 @@ return set().union( *[ revs - for phase, revs in pycompat.iteritems(self.phaseroots) + for phase, revs in self.phaseroots.items() if phase != public ] ) @@ -528,7 +526,7 @@ f.close() def _write(self, fp): - for phase, roots in pycompat.iteritems(self.phaseroots): + for phase, roots in self.phaseroots.items(): for h in sorted(roots): fp.write(b'%i %s\n' % (phase, hex(h))) self.dirty = False @@ -612,7 +610,7 @@ def retractboundary(self, repo, tr, targetphase, nodes): oldroots = { phase: revs - for phase, revs in pycompat.iteritems(self.phaseroots) + for phase, revs in self.phaseroots.items() if phase <= targetphase } if tr is None: @@ -690,7 +688,7 @@ """ filtered = False has_node = repo.changelog.index.has_node # to filter unknown nodes - for phase, nodes in pycompat.iteritems(self.phaseroots): + for phase, nodes in self.phaseroots.items(): missing = sorted(node for node in nodes if not has_node(node)) if missing: for mnode in missing: @@ -854,7 +852,7 @@ # build list from dictionary draftroots = [] has_node = repo.changelog.index.has_node # to filter unknown nodes - for nhex, phase in pycompat.iteritems(roots): + for nhex, phase in roots.items(): if nhex == b'publishing': # ignore data related to publish option continue node = bin(nhex)