comparison mercurial/debugcommands.py @ 44452:9d2b2df2c2ba

cleanup: run pyupgrade on our source tree to clean up varying things Built with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**' | xargs pyupgrade --keep-percent-format --keep-extraneous-parens and then blackened. pyupgrade comes from https://github.com/asottile/pyupgrade with a patch to let me preserve extraneous parens (which we use for marking strings that shouldn't be translated), and lets us clean up a bunch of idioms that have cruftily accumulated over the years. # skip-blame no-op automated code cleanups Differential Revision: https://phab.mercurial-scm.org/D8255
author Augie Fackler <augie@google.com>
date Fri, 06 Mar 2020 13:27:41 -0500
parents f82d2d4e71db
children 295417387769
comparison
equal deleted inserted replaced
44449:ff72bd52d56a 44452:9d2b2df2c2ba
582 """ 582 """
583 spaces = opts.get('spaces') 583 spaces = opts.get('spaces')
584 dots = opts.get('dots') 584 dots = opts.get('dots')
585 if file_: 585 if file_:
586 rlog = revlog.revlog(vfsmod.vfs(encoding.getcwd(), audit=False), file_) 586 rlog = revlog.revlog(vfsmod.vfs(encoding.getcwd(), audit=False), file_)
587 revs = set((int(r) for r in revs)) 587 revs = {int(r) for r in revs}
588 588
589 def events(): 589 def events():
590 for r in rlog: 590 for r in rlog:
591 yield b'n', (r, list(p for p in rlog.parentrevs(r) if p != -1)) 591 yield b'n', (r, list(p for p in rlog.parentrevs(r) if p != -1))
592 if r in revs: 592 if r in revs:
1132 stages = [ 1132 stages = [
1133 (b'parsed', pycompat.identity), 1133 (b'parsed', pycompat.identity),
1134 (b'analyzed', filesetlang.analyze), 1134 (b'analyzed', filesetlang.analyze),
1135 (b'optimized', filesetlang.optimize), 1135 (b'optimized', filesetlang.optimize),
1136 ] 1136 ]
1137 stagenames = set(n for n, f in stages) 1137 stagenames = {n for n, f in stages}
1138 1138
1139 showalways = set() 1139 showalways = set()
1140 if ui.verbose and not opts[b'show_stage']: 1140 if ui.verbose and not opts[b'show_stage']:
1141 # show parsed tree by --verbose (deprecated) 1141 # show parsed tree by --verbose (deprecated)
1142 showalways.add(b'parsed') 1142 showalways.add(b'parsed')
2596 if opts.get('minimal'): 2596 if opts.get('minimal'):
2597 manifestfiles = set(ctx.manifest().keys()) 2597 manifestfiles = set(ctx.manifest().keys())
2598 dirstatefiles = set(dirstate) 2598 dirstatefiles = set(dirstate)
2599 manifestonly = manifestfiles - dirstatefiles 2599 manifestonly = manifestfiles - dirstatefiles
2600 dsonly = dirstatefiles - manifestfiles 2600 dsonly = dirstatefiles - manifestfiles
2601 dsnotadded = set(f for f in dsonly if dirstate[f] != b'a') 2601 dsnotadded = {f for f in dsonly if dirstate[f] != b'a'}
2602 changedfiles = manifestonly | dsnotadded 2602 changedfiles = manifestonly | dsnotadded
2603 2603
2604 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles) 2604 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
2605 2605
2606 2606
3163 stages = stages[:-1] 3163 stages = stages[:-1]
3164 if opts[b'verify_optimized'] and opts[b'no_optimized']: 3164 if opts[b'verify_optimized'] and opts[b'no_optimized']:
3165 raise error.Abort( 3165 raise error.Abort(
3166 _(b'cannot use --verify-optimized with --no-optimized') 3166 _(b'cannot use --verify-optimized with --no-optimized')
3167 ) 3167 )
3168 stagenames = set(n for n, f in stages) 3168 stagenames = {n for n, f in stages}
3169 3169
3170 showalways = set() 3170 showalways = set()
3171 showchanged = set() 3171 showchanged = set()
3172 if ui.verbose and not opts[b'show_stage']: 3172 if ui.verbose and not opts[b'show_stage']:
3173 # show parsed tree by --verbose (deprecated) 3173 # show parsed tree by --verbose (deprecated)