# HG changeset patch # User Matt Mackall # Date 1406320509 18000 # Node ID 0483ff40e326f2eeb8d664263dbcb6de33fba2b1 # Parent 8534e670f4ee3c598b1b0ad4037fcda9647f744a 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. diff -r 8534e670f4ee -r 0483ff40e326 mercurial/cmdutil.py --- 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? diff -r 8534e670f4ee -r 0483ff40e326 mercurial/commands.py --- 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)" diff -r 8534e670f4ee -r 0483ff40e326 tests/test-command-template.t --- 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