[PATCH] logstyle: Show the style list when I try to use a wrong one

Iulian Stana julian.stana at gmail.com
Wed Apr 17 15:43:58 UTC 2013


# HG changeset patch
# User Iulian Stana <julian.stana at gmail.com>
# Date 1366213347 -10800
#      Wed Apr 17 18:42:27 2013 +0300
# Node ID 98bcf83d70b195b64c0ee3c901cd6780bacd806d
# Parent  186c1300c10d40b4d6871e851b57d8d44368dcb0
logstyle: Show the style list when I try to use a wrong one.

diff -r 186c1300c10d -r 98bcf83d70b1 mercurial/templater.py
--- a/mercurial/templater.py	Tue Apr 16 22:09:28 2013 +0300
+++ b/mercurial/templater.py	Wed Apr 17 18:42:27 2013 +0300
@@ -391,6 +391,16 @@
 
 engines = {'default': engine}
 
+def stylelist(mapfile):
+    path = "mercurial/templates"
+    dirlist =  os.listdir(path)
+    stylelist = 'the "%s" style is not found try: \n\n' % mapfile
+    for file in dirlist:
+        split = file.split(".")
+        if split[0] == "map-cmdline":
+            stylelist = stylelist + '\t' + split[1] + '\n'
+    return stylelist
+
 class templater(object):
 
     def __init__(self, mapfile, filters={}, defaults={}, cache={},
@@ -412,7 +422,8 @@
         if not mapfile:
             return
         if not os.path.exists(mapfile):
-            raise util.Abort(_('style not found: %s') % mapfile)
+            print stylelist(mapfile)
+            sys.exit()
 
         conf = config.config()
         conf.read(mapfile)



More information about the Mercurial-devel mailing list