Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.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 | c9774f5fa729 |
comparison
equal
deleted
inserted
replaced
49003:a0674e916fb6 | 49004:f254fc73d956 |
---|---|
490 for c in sorted(caps): | 490 for c in sorted(caps): |
491 ui.write(b' %s\n' % c) | 491 ui.write(b' %s\n' % c) |
492 b2caps = bundle2.bundle2caps(peer) | 492 b2caps = bundle2.bundle2caps(peer) |
493 if b2caps: | 493 if b2caps: |
494 ui.writenoi18n(b'Bundle2 capabilities:\n') | 494 ui.writenoi18n(b'Bundle2 capabilities:\n') |
495 for key, values in sorted(pycompat.iteritems(b2caps)): | 495 for key, values in sorted(b2caps.items()): |
496 ui.write(b' %s\n' % key) | 496 ui.write(b' %s\n' % key) |
497 for v in values: | 497 for v in values: |
498 ui.write(b' %s\n' % v) | 498 ui.write(b' %s\n' % v) |
499 finally: | 499 finally: |
500 peer.close() | 500 peer.close() |
2386 fm_extras = fm.nested(b'extras') | 2386 fm_extras = fm.nested(b'extras') |
2387 for f, d in sorted(pycompat.iteritems(ms.allextras())): | 2387 for f, d in sorted(pycompat.iteritems(ms.allextras())): |
2388 if f in ms: | 2388 if f in ms: |
2389 # If file is in mergestate, we have already processed it's extras | 2389 # If file is in mergestate, we have already processed it's extras |
2390 continue | 2390 continue |
2391 for k, v in pycompat.iteritems(d): | 2391 for k, v in d.items(): |
2392 fm_extras.startitem() | 2392 fm_extras.startitem() |
2393 fm_extras.data(file=f) | 2393 fm_extras.data(file=f) |
2394 fm_extras.data(key=k) | 2394 fm_extras.data(key=k) |
2395 fm_extras.data(value=v) | 2395 fm_extras.data(value=v) |
2396 fm_extras.end() | 2396 fm_extras.end() |
2403 '''complete "names" - tags, open branch names, bookmark names''' | 2403 '''complete "names" - tags, open branch names, bookmark names''' |
2404 | 2404 |
2405 names = set() | 2405 names = set() |
2406 # since we previously only listed open branches, we will handle that | 2406 # since we previously only listed open branches, we will handle that |
2407 # specially (after this for loop) | 2407 # specially (after this for loop) |
2408 for name, ns in pycompat.iteritems(repo.names): | 2408 for name, ns in repo.names.items(): |
2409 if name != b'branches': | 2409 if name != b'branches': |
2410 names.update(ns.listnames(repo)) | 2410 names.update(ns.listnames(repo)) |
2411 names.update( | 2411 names.update( |
2412 tag | 2412 tag |
2413 for (tag, heads, tip, closed) in repo.branchmap().iterbranches() | 2413 for (tag, heads, tip, closed) in repo.branchmap().iterbranches() |
2697 spec = spec.replace(pycompat.ossep, b'/') | 2697 spec = spec.replace(pycompat.ossep, b'/') |
2698 speclen = len(spec) | 2698 speclen = len(spec) |
2699 fullpaths = opts['full'] | 2699 fullpaths = opts['full'] |
2700 files, dirs = set(), set() | 2700 files, dirs = set(), set() |
2701 adddir, addfile = dirs.add, files.add | 2701 adddir, addfile = dirs.add, files.add |
2702 for f, st in pycompat.iteritems(dirstate): | 2702 for f, st in dirstate.items(): |
2703 if f.startswith(spec) and st.state in acceptable: | 2703 if f.startswith(spec) and st.state in acceptable: |
2704 if fixpaths: | 2704 if fixpaths: |
2705 f = f.replace(b'/', pycompat.ossep) | 2705 f = f.replace(b'/', pycompat.ossep) |
2706 if fullpaths: | 2706 if fullpaths: |
2707 addfile(f) | 2707 addfile(f) |
4268 repo = hg.peer(ui, opts, repopath) | 4268 repo = hg.peer(ui, opts, repopath) |
4269 try: | 4269 try: |
4270 for opt in cmdutil.remoteopts: | 4270 for opt in cmdutil.remoteopts: |
4271 del opts[opt[1]] | 4271 del opts[opt[1]] |
4272 args = {} | 4272 args = {} |
4273 for k, v in pycompat.iteritems(opts): | 4273 for k, v in opts.items(): |
4274 if v: | 4274 if v: |
4275 args[k] = v | 4275 args[k] = v |
4276 args = pycompat.strkwargs(args) | 4276 args = pycompat.strkwargs(args) |
4277 # run twice to check that we don't mess up the stream for the next command | 4277 # run twice to check that we don't mess up the stream for the next command |
4278 res1 = repo.debugwireargs(*vals, **args) | 4278 res1 = repo.debugwireargs(*vals, **args) |