mercurial/templater.py
changeset 28630 bf35644b9f3a
parent 28628 ed1d90f6e921
child 28687 29c249dfb4ef
--- a/mercurial/templater.py	Sat Mar 26 19:01:12 2016 +0900
+++ b/mercurial/templater.py	Sat Mar 26 18:12:12 2016 +0900
@@ -867,9 +867,9 @@
                     yield j
 
 def unquotestring(s):
-    '''unwrap quotes'''
+    '''unwrap quotes if any; otherwise returns unmodified string'''
     if len(s) < 2 or s[0] != s[-1]:
-        raise SyntaxError(_('unmatched quotes'))
+        return s
     return s[1:-1]
 
 class engine(object):
@@ -980,10 +980,10 @@
             if not val:
                 raise error.ParseError(_('missing value'), conf.source('', key))
             if val[0] in "'\"":
-                try:
-                    self.cache[key] = unquotestring(val)
-                except SyntaxError as inst:
-                    raise error.ParseError(inst.args[0], conf.source('', key))
+                if val[0] != val[-1]:
+                    raise error.ParseError(_('unmatched quotes'),
+                                           conf.source('', key))
+                self.cache[key] = unquotestring(val)
             else:
                 val = 'default', val
                 if ':' in val[1]: