comparison mercurial/debugcommands.py @ 38361:d4fae9a0ab1f

templater: add function to look up symbols used in template Formatter can use this information to enable slow paths such as loading ctx object only when necessary.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 03 May 2018 11:53:56 +0900
parents 275cc461b854
children fce1c17493db
comparison
equal deleted inserted replaced
38360:e637dc0b3b1f 38361:d4fae9a0ab1f
2486 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n') 2486 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2487 2487
2488 if revs is None: 2488 if revs is None:
2489 tres = formatter.templateresources(ui, repo) 2489 tres = formatter.templateresources(ui, repo)
2490 t = formatter.maketemplater(ui, tmpl, resources=tres) 2490 t = formatter.maketemplater(ui, tmpl, resources=tres)
2491 if ui.verbose:
2492 kwds, funcs = t.symbolsuseddefault()
2493 ui.write(("* keywords: %s\n") % ', '.join(sorted(kwds)))
2494 ui.write(("* functions: %s\n") % ', '.join(sorted(funcs)))
2491 ui.write(t.renderdefault(props)) 2495 ui.write(t.renderdefault(props))
2492 else: 2496 else:
2493 displayer = logcmdutil.maketemplater(ui, repo, tmpl) 2497 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2498 if ui.verbose:
2499 kwds, funcs = displayer.t.symbolsuseddefault()
2500 ui.write(("* keywords: %s\n") % ', '.join(sorted(kwds)))
2501 ui.write(("* functions: %s\n") % ', '.join(sorted(funcs)))
2494 for r in revs: 2502 for r in revs:
2495 displayer.show(repo[r], **pycompat.strkwargs(props)) 2503 displayer.show(repo[r], **pycompat.strkwargs(props))
2496 displayer.close() 2504 displayer.close()
2497 2505
2498 @command('debuguigetpass', [ 2506 @command('debuguigetpass', [