diff mercurial/cmdutil.py @ 16678:48b1674ac1e7 stable

templater: handle SyntaxError when parsing ui.logtemplate Before, Mercurial would crash with a traceback ending with SyntaxError: unmatched quotes if you configured [ui] logtemplate = {rev}\n The SyntaxError is now catched and the string is re-parsed without requiring quotes.
author Martin Geisler <martin@geisler.net>
date Sat, 12 May 2012 22:12:54 +0200
parents f30226b1a46a
children d947e1da1259 2440822446ce
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sat May 12 09:43:12 2012 +0200
+++ b/mercurial/cmdutil.py	Sat May 12 22:12:54 2012 +0200
@@ -910,7 +910,10 @@
     if not (tmpl or style):
         tmpl = ui.config('ui', 'logtemplate')
         if tmpl:
-            tmpl = templater.parsestring(tmpl)
+            try:
+                tmpl = templater.parsestring(tmpl)
+            except SyntaxError:
+                tmpl = templater.parsestring(tmpl, quoted=False)
         else:
             style = util.expandpath(ui.config('ui', 'style', ''))