Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
16652:2fdd1902ed2d | 16678:48b1674ac1e7 |
---|---|
908 | 908 |
909 # ui settings | 909 # ui settings |
910 if not (tmpl or style): | 910 if not (tmpl or style): |
911 tmpl = ui.config('ui', 'logtemplate') | 911 tmpl = ui.config('ui', 'logtemplate') |
912 if tmpl: | 912 if tmpl: |
913 tmpl = templater.parsestring(tmpl) | 913 try: |
914 tmpl = templater.parsestring(tmpl) | |
915 except SyntaxError: | |
916 tmpl = templater.parsestring(tmpl, quoted=False) | |
914 else: | 917 else: |
915 style = util.expandpath(ui.config('ui', 'style', '')) | 918 style = util.expandpath(ui.config('ui', 'style', '')) |
916 | 919 |
917 if not (tmpl or style): | 920 if not (tmpl or style): |
918 return changeset_printer(ui, repo, patch, opts, buffered) | 921 return changeset_printer(ui, repo, patch, opts, buffered) |