Mercurial > hg-stable
changeset 21944:0483ff40e326 stable
templates: re-add template listing support
We used to have --style nosuch to list templates, but --style is now
merged with --template/-T where random strings are acceptable
templates. So we reserve 'list' to allow listing templates.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 25 Jul 2014 15:35:09 -0500 |
parents | 8534e670f4ee |
children | d603e7333281 |
files | mercurial/cmdutil.py mercurial/commands.py tests/test-command-template.t |
diffstat | 3 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Mon Jul 21 11:44:20 2014 +0900 +++ b/mercurial/cmdutil.py Fri Jul 25 15:35:09 2014 -0500 @@ -1126,6 +1126,10 @@ tmpl = templater.parsestring(t, quoted=False) return tmpl, None + if tmpl == 'list': + ui.write(_("available styles: %s\n") % templater.stylelist()) + raise util.Abort(_("specify a template")) + # perhaps it's a path to a map or a template if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl): # is it a mapfile for a style?
--- a/mercurial/commands.py Mon Jul 21 11:44:20 2014 +0900 +++ b/mercurial/commands.py Fri Jul 25 15:35:09 2014 -0500 @@ -4129,6 +4129,10 @@ hg log -k bug --template "{rev}\\n" + - list available log templates:: + + hg log -T list + - check if a given changeset is included is a tagged release:: hg log -r "a21ccf and ancestor(1.9)"
--- a/tests/test-command-template.t Mon Jul 21 11:44:20 2014 +0900 +++ b/tests/test-command-template.t Fri Jul 25 15:35:09 2014 -0500 @@ -485,6 +485,11 @@ (available styles: bisect, changelog, compact, default, phases, xml) [255] + $ hg log -T list + available styles: bisect, changelog, compact, default, phases, xml + abort: specify a template + [255] + Error if style missing key: $ echo 'q = q' > t