Mercurial > hg
comparison mercurial/templater.py @ 28687:29c249dfb4ef
templater: do not strip non-quote characters from template config
Before this patch, the first and last characters were stripped from
ui.logtemplate and template.* if they were the same. It could lead to a
strange result as quotes are optional. See the test for example.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 27 Mar 2016 17:42:19 +0900 |
parents | bf35644b9f3a |
children | cc103bd0dbf9 |
comparison
equal
deleted
inserted
replaced
28686:b212e01fead0 | 28687:29c249dfb4ef |
---|---|
866 for j in _flatten(i): | 866 for j in _flatten(i): |
867 yield j | 867 yield j |
868 | 868 |
869 def unquotestring(s): | 869 def unquotestring(s): |
870 '''unwrap quotes if any; otherwise returns unmodified string''' | 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] not in "'\"" or s[0] != s[-1]: |
872 return s | 872 return s |
873 return s[1:-1] | 873 return s[1:-1] |
874 | 874 |
875 class engine(object): | 875 class engine(object): |
876 '''template expansion engine. | 876 '''template expansion engine. |