changeset 25696:c1cac25ad1a6

templater: remove workaround for escaped quoted string in quoted template This patch backs out 554d6fcc3c84 which should no longer be needed. The test for '{\"invalid\"}' is removed because the parser is permissive for \"...\" literal.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 27 Jun 2015 15:28:46 +0900
parents ce3d4b858420
children 1538e72209fd
files mercurial/templater.py tests/test-command-template.t
diffstat 2 files changed, 1 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Wed Jul 01 16:33:31 2015 -0500
+++ b/mercurial/templater.py	Sat Jun 27 15:28:46 2015 +0900
@@ -698,21 +698,7 @@
     '''unwrap quotes'''
     if len(s) < 2 or s[0] != s[-1]:
         raise SyntaxError(_('unmatched quotes'))
-    # de-backslash-ify only <\">. it is invalid syntax in non-string part of
-    # template, but we are likely to escape <"> in quoted string and it was
-    # accepted before, thanks to issue4290. <\\"> is unmodified because it
-    # is ambiguous and it was processed as such before 2.8.1.
-    #
-    #  template  result
-    #  --------- ------------------------
-    #  {\"\"}    parse error
-    #  "{""}"    {""} -> <>
-    #  "{\"\"}"  {""} -> <>
-    #  {"\""}    {"\""} -> <">
-    #  '{"\""}'  {"\""} -> <">
-    #  "{"\""}"  parse error (don't care)
-    q = s[0]
-    return s[1:-1].replace('\\\\' + q, '\\\\\\' + q).replace('\\' + q, q)
+    return s[1:-1]
 
 class engine(object):
     '''template expansion engine.
--- a/tests/test-command-template.t	Wed Jul 01 16:33:31 2015 -0500
+++ b/tests/test-command-template.t	Sat Jun 27 15:28:46 2015 +0900
@@ -2880,9 +2880,6 @@
   $ hg log -r 2 --style ../escquotetmpl
   " \" \" \\" head1
 
-  $ hg log -r 2 -T esc --config templates.esc='{\"invalid\"}\n'
-  hg: parse error at 1: syntax error
-  [255]
   $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"'
   valid
   $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"