diff mercurial/cmdutil.py @ 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 5375ba75df40
children be94ed4baa5d
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?