Show More
@@ -698,21 +698,7 b' def unquotestring(s):' | |||||
698 | '''unwrap quotes''' |
|
698 | '''unwrap quotes''' | |
699 | if len(s) < 2 or s[0] != s[-1]: |
|
699 | if len(s) < 2 or s[0] != s[-1]: | |
700 | raise SyntaxError(_('unmatched quotes')) |
|
700 | raise SyntaxError(_('unmatched quotes')) | |
701 | # de-backslash-ify only <\">. it is invalid syntax in non-string part of |
|
701 | return s[1:-1] | |
702 | # template, but we are likely to escape <"> in quoted string and it was |
|
|||
703 | # accepted before, thanks to issue4290. <\\"> is unmodified because it |
|
|||
704 | # is ambiguous and it was processed as such before 2.8.1. |
|
|||
705 | # |
|
|||
706 | # template result |
|
|||
707 | # --------- ------------------------ |
|
|||
708 | # {\"\"} parse error |
|
|||
709 | # "{""}" {""} -> <> |
|
|||
710 | # "{\"\"}" {""} -> <> |
|
|||
711 | # {"\""} {"\""} -> <"> |
|
|||
712 | # '{"\""}' {"\""} -> <"> |
|
|||
713 | # "{"\""}" parse error (don't care) |
|
|||
714 | q = s[0] |
|
|||
715 | return s[1:-1].replace('\\\\' + q, '\\\\\\' + q).replace('\\' + q, q) |
|
|||
716 |
|
702 | |||
717 | class engine(object): |
|
703 | class engine(object): | |
718 | '''template expansion engine. |
|
704 | '''template expansion engine. |
@@ -2880,9 +2880,6 b' stripped before parsing:' | |||||
2880 | $ hg log -r 2 --style ../escquotetmpl |
|
2880 | $ hg log -r 2 --style ../escquotetmpl | |
2881 | " \" \" \\" head1 |
|
2881 | " \" \" \\" head1 | |
2882 |
|
2882 | |||
2883 | $ hg log -r 2 -T esc --config templates.esc='{\"invalid\"}\n' |
|
|||
2884 | hg: parse error at 1: syntax error |
|
|||
2885 | [255] |
|
|||
2886 | $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"' |
|
2883 | $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"' | |
2887 | valid |
|
2884 | valid | |
2888 | $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'" |
|
2885 | $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'" |
General Comments 0
You need to be logged in to leave comments.
Login now