Show More
@@ -1542,11 +1542,7 b' def gettemplate(ui, tmpl, style):' | |||||
1542 | if not tmpl and not style: # template are stronger than style |
|
1542 | if not tmpl and not style: # template are stronger than style | |
1543 | tmpl = ui.config('ui', 'logtemplate') |
|
1543 | tmpl = ui.config('ui', 'logtemplate') | |
1544 | if tmpl: |
|
1544 | if tmpl: | |
1545 | try: |
|
1545 | return templater.unquotestring(tmpl), None | |
1546 | tmpl = templater.unquotestring(tmpl) |
|
|||
1547 | except SyntaxError: |
|
|||
1548 | pass |
|
|||
1549 | return tmpl, None |
|
|||
1550 | else: |
|
1546 | else: | |
1551 | style = util.expandpath(ui.config('ui', 'style', '')) |
|
1547 | style = util.expandpath(ui.config('ui', 'style', '')) | |
1552 |
|
1548 |
@@ -171,11 +171,7 b' def lookuptemplate(ui, topic, tmpl):' | |||||
171 | # perhaps it's a reference to [templates] |
|
171 | # perhaps it's a reference to [templates] | |
172 | t = ui.config('templates', tmpl) |
|
172 | t = ui.config('templates', tmpl) | |
173 | if t: |
|
173 | if t: | |
174 | try: |
|
174 | return templater.unquotestring(t), None | |
175 | tmpl = templater.unquotestring(t) |
|
|||
176 | except SyntaxError: |
|
|||
177 | tmpl = t |
|
|||
178 | return tmpl, None |
|
|||
179 |
|
175 | |||
180 | if tmpl == 'list': |
|
176 | if tmpl == 'list': | |
181 | ui.write(_("available styles: %s\n") % templater.stylelist()) |
|
177 | ui.write(_("available styles: %s\n") % templater.stylelist()) |
@@ -867,9 +867,9 b' def _flatten(thing):' | |||||
867 | yield j |
|
867 | yield j | |
868 |
|
868 | |||
869 | def unquotestring(s): |
|
869 | def unquotestring(s): | |
870 | '''unwrap quotes''' |
|
870 | '''unwrap quotes if any; otherwise returns unmodified string''' | |
871 | if len(s) < 2 or s[0] != s[-1]: |
|
871 | if len(s) < 2 or s[0] != s[-1]: | |
872 | raise SyntaxError(_('unmatched quotes')) |
|
872 | return s | |
873 | return s[1:-1] |
|
873 | return s[1:-1] | |
874 |
|
874 | |||
875 | class engine(object): |
|
875 | class engine(object): | |
@@ -980,10 +980,10 b' class templater(object):' | |||||
980 | if not val: |
|
980 | if not val: | |
981 | raise error.ParseError(_('missing value'), conf.source('', key)) |
|
981 | raise error.ParseError(_('missing value'), conf.source('', key)) | |
982 | if val[0] in "'\"": |
|
982 | if val[0] in "'\"": | |
983 | try: |
|
983 | if val[0] != val[-1]: | |
984 | self.cache[key] = unquotestring(val) |
|
984 | raise error.ParseError(_('unmatched quotes'), | |
985 | except SyntaxError as inst: |
|
985 | conf.source('', key)) | |
986 | raise error.ParseError(inst.args[0], conf.source('', key)) |
|
986 | self.cache[key] = unquotestring(val) | |
987 | else: |
|
987 | else: | |
988 | val = 'default', val |
|
988 | val = 'default', val | |
989 | if ':' in val[1]: |
|
989 | if ':' in val[1]: |
General Comments 0
You need to be logged in to leave comments.
Login now