Mercurial > hg
diff mercurial/localrepo.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 | 1414b65303d5 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Mar 03 17:39:20 2022 -0800 +++ b/mercurial/localrepo.py Thu Mar 03 18:28:30 2022 -0800 @@ -2068,7 +2068,7 @@ else: tags = self._tagscache.tags rev = self.changelog.rev - for k, v in pycompat.iteritems(tags): + for k, v in tags.items(): try: # ignore tags to unknown nodes rev(v) @@ -2103,13 +2103,12 @@ # writing to the cache), but the rest of Mercurial wants them in # local encoding. tags = {} - for (name, (node, hist)) in pycompat.iteritems(alltags): + for (name, (node, hist)) in alltags.items(): if node != self.nullid: tags[encoding.tolocal(name)] = node tags[b'tip'] = self.changelog.tip() tagtypes = { - encoding.tolocal(name): value - for (name, value) in pycompat.iteritems(tagtypes) + encoding.tolocal(name): value for (name, value) in tagtypes.items() } return (tags, tagtypes) @@ -2138,7 +2137,7 @@ '''return the tags associated with a node''' if not self._tagscache.nodetagscache: nodetagscache = {} - for t, n in pycompat.iteritems(self._tagscache.tags): + for t, n in self._tagscache.tags.items(): nodetagscache.setdefault(n, []).append(t) for tags in pycompat.itervalues(nodetagscache): tags.sort() @@ -2256,7 +2255,7 @@ mf = matchmod.match(self.root, b'', [pat]) fn = None params = cmd - for name, filterfn in pycompat.iteritems(self._datafilters): + for name, filterfn in self._datafilters.items(): if cmd.startswith(name): fn = filterfn params = cmd[len(name) :].lstrip()