Mercurial > hg
diff hgext/infinitepush/__init__.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 | 78911231ed33 |
line wrap: on
line diff
--- a/hgext/infinitepush/__init__.py Thu Mar 03 17:39:20 2022 -0800 +++ b/hgext/infinitepush/__init__.py Thu Mar 03 18:28:30 2022 -0800 @@ -419,7 +419,7 @@ if pattern.endswith(b'*'): pattern = b're:^' + pattern[:-1] + b'.*' kind, pat, matcher = stringutil.stringmatcher(pattern) - for bookmark, node in pycompat.iteritems(bookmarks): + for bookmark, node in bookmarks.items(): if matcher(bookmark): results[bookmark] = node return results @@ -542,7 +542,7 @@ if part.type == b'changegroup': haschangegroup = True newpart = bundle2.bundlepart(part.type, data=part.read()) - for key, value in pycompat.iteritems(part.params): + for key, value in part.params.items(): newpart.addparam(key, value) parts.append(newpart) @@ -794,7 +794,7 @@ # saveremotenames expects 20 byte binary nodes for branches branches[rname].append(bin(hexnode)) - for bookmark, hexnode in pycompat.iteritems(newbookmarks): + for bookmark, hexnode in newbookmarks.items(): bookmarks[bookmark] = hexnode remotenamesext.saveremotenames(repo, remotepath, branches, bookmarks) @@ -804,7 +804,7 @@ return with repo.wlock(), repo.lock(), repo.transaction(b'bookmark') as tr: changes = [] - for scratchbook, node in pycompat.iteritems(bookmarks): + for scratchbook, node in bookmarks.items(): changectx = repo[node] changes.append((scratchbook, changectx.node())) repo._bookmarks.applychanges(repo, tr, changes) @@ -1045,7 +1045,7 @@ bundle2._processpart(op, part) else: bundlepart = bundle2.bundlepart(part.type, data=part.read()) - for key, value in pycompat.iteritems(part.params): + for key, value in part.params.items(): bundlepart.addparam(key, value) # Certain parts require a response @@ -1137,7 +1137,7 @@ # differs from previous behavior, we need to put it behind a # config flag for incremental rollout. bundlepart = bundle2.bundlepart(part.type, data=part.read()) - for key, value in pycompat.iteritems(part.params): + for key, value in part.params.items(): bundlepart.addparam(key, value) # Certain parts require a response @@ -1323,9 +1323,7 @@ b'new': newnode, b'old': oldnode, } - op.reply.newpart( - b'pushkey', mandatoryparams=pycompat.iteritems(params) - ) + op.reply.newpart(b'pushkey', mandatoryparams=params.items()) def bundle2pushkey(orig, op, part):