comparison mercurial/debugcommands.py @ 38263:dbf31732ef64

debugwalk: pretty-print nested matcher While porting filesets to composition of matchers, I found the original one-liner was hard to read.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 10 Jun 2018 11:55:52 +0900
parents 7c3a59e2971b
children 275cc461b854
comparison
equal deleted inserted replaced
38262:7c3a59e2971b 38263:dbf31732ef64
2541 def debugwalk(ui, repo, *pats, **opts): 2541 def debugwalk(ui, repo, *pats, **opts):
2542 """show how files match on given patterns""" 2542 """show how files match on given patterns"""
2543 opts = pycompat.byteskwargs(opts) 2543 opts = pycompat.byteskwargs(opts)
2544 m = scmutil.match(repo[None], pats, opts) 2544 m = scmutil.match(repo[None], pats, opts)
2545 if ui.verbose: 2545 if ui.verbose:
2546 ui.write(('matcher: %r\n' % m)) 2546 ui.write(('* matcher:\n'), stringutil.prettyrepr(m), '\n')
2547 items = list(repo[None].walk(m)) 2547 items = list(repo[None].walk(m))
2548 if not items: 2548 if not items:
2549 return 2549 return
2550 f = lambda fn: fn 2550 f = lambda fn: fn
2551 if ui.configbool('ui', 'slash') and pycompat.ossep != '/': 2551 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':