Mercurial > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Thu May 03 11:17:52 2018 +0900 +++ b/mercurial/debugcommands.py Thu May 03 11:53:56 2018 +0900 @@ -2488,9 +2488,17 @@ if revs is None: tres = formatter.templateresources(ui, repo) t = formatter.maketemplater(ui, tmpl, resources=tres) + if ui.verbose: + kwds, funcs = t.symbolsuseddefault() + ui.write(("* keywords: %s\n") % ', '.join(sorted(kwds))) + ui.write(("* functions: %s\n") % ', '.join(sorted(funcs))) ui.write(t.renderdefault(props)) else: displayer = logcmdutil.maketemplater(ui, repo, tmpl) + if ui.verbose: + kwds, funcs = displayer.t.symbolsuseddefault() + ui.write(("* keywords: %s\n") % ', '.join(sorted(kwds))) + ui.write(("* functions: %s\n") % ', '.join(sorted(funcs))) for r in revs: displayer.show(repo[r], **pycompat.strkwargs(props)) displayer.close()