Mercurial > hg
diff hgext/absorb.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/hgext/absorb.py Thu Mar 03 17:39:20 2022 -0800 +++ b/hgext/absorb.py Thu Mar 03 18:28:30 2022 -0800 @@ -733,7 +733,7 @@ def apply(self): """apply fixups to individual filefixupstates""" - for path, state in pycompat.iteritems(self.fixupmap): + for path, state in self.fixupmap.items(): if self.ui.debugflag: self.ui.write(_(b'applying fixups to %s\n') % path) state.apply() @@ -741,10 +741,7 @@ @property def chunkstats(self): """-> {path: chunkstats}. collect chunkstats from filefixupstates""" - return { - path: state.chunkstats - for path, state in pycompat.iteritems(self.fixupmap) - } + return {path: state.chunkstats for path, state in self.fixupmap.items()} def commit(self): """commit changes. update self.finalnode, self.replacemap""" @@ -762,7 +759,7 @@ chunkstats = self.chunkstats if ui.verbose: # chunkstats for each file - for path, stat in pycompat.iteritems(chunkstats): + for path, stat in chunkstats.items(): if stat[0]: ui.write( _(b'%s: %d of %d chunk(s) applied\n') @@ -845,7 +842,7 @@ repo = self.repo needupdate = [ (name, self.replacemap[hsh]) - for name, hsh in pycompat.iteritems(repo._bookmarks) + for name, hsh in repo._bookmarks.items() if hsh in self.replacemap ] changes = [] @@ -908,7 +905,7 @@ # ctx changes more files (not a subset of memworkingcopy) if not set(ctx.files()).issubset(set(memworkingcopy)): return False - for path, content in pycompat.iteritems(memworkingcopy): + for path, content in memworkingcopy.items(): if path not in pctx or path not in ctx: return False fctx = ctx[path] @@ -951,7 +948,7 @@ def _cleanupoldcommits(self): replacements = { k: ([v] if v is not None else []) - for k, v in pycompat.iteritems(self.replacemap) + for k, v in self.replacemap.items() } if replacements: scmutil.cleanupnodes( @@ -1001,7 +998,7 @@ if not path or not info: continue patchmap[path].append(info) - for path, patches in pycompat.iteritems(patchmap): + for path, patches in patchmap.items(): if path not in ctx or not patches: continue patches.sort(reverse=True)