Mercurial > public > mercurial-scm > hg-stable
diff mercurial/scmutil.py @ 49004: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 | 06de08b36c82 |
line wrap: on
line diff
--- a/mercurial/scmutil.py Thu Mar 03 17:39:20 2022 -0800 +++ b/mercurial/scmutil.py Thu Mar 03 18:28:30 2022 -0800 @@ -108,7 +108,7 @@ del subpaths[subpath] missing.add(subpath) - for subpath, ctx in sorted(pycompat.iteritems(subpaths)): + for subpath, ctx in sorted(subpaths.items()): yield subpath, ctx.sub(subpath) # Yield an empty subrepo based on ctx1 for anything only in ctx2. That way, @@ -1336,7 +1336,7 @@ ignored=False, full=False, ) - for abs, st in pycompat.iteritems(walkresults): + for abs, st in walkresults.items(): entry = dirstate.get_entry(abs) if (not entry.any_tracked) and audit_path.check(abs): unknown.append(abs) @@ -1383,7 +1383,7 @@ with repo.wlock(): wctx.forget(deleted) wctx.add(unknown) - for new, old in pycompat.iteritems(renames): + for new, old in renames.items(): wctx.copy(old, new) @@ -1509,12 +1509,9 @@ # Merge old parent and old working dir copies oldcopies = copiesmod.pathcopies(newctx, oldctx, match) oldcopies.update(copies) - copies = { - dst: oldcopies.get(src, src) - for dst, src in pycompat.iteritems(oldcopies) - } + copies = {dst: oldcopies.get(src, src) for dst, src in oldcopies.items()} # Adjust the dirstate copies - for dst, src in pycompat.iteritems(copies): + for dst, src in copies.items(): if src not in newctx or dst in newctx or not ds.get_entry(dst).added: src = None ds.copy(src, dst)