Mercurial > public > mercurial-scm > hg
diff tests/test-command-template.t @ 24949:890845af1ac2 stable
templater: strictly parse leading backslashes of '{' (issue4569) (BC)
Because double backslashes are processed as a string escape sequence, '\\{'
should start the template syntax. On the other hand, r'' disables any sort
of \-escapes, so r'\{' can go either way, never start the template syntax
or always start it. I simply chose the latter, which means r'\{' is the same
as '\\{'.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 04 May 2015 10:17:34 +0900 |
parents | db7463aa080f |
children | eeca859cc045 7298da81f5a9 |
line wrap: on
line diff
--- a/tests/test-command-template.t Mon May 04 09:54:01 2015 +0900 +++ b/tests/test-command-template.t Mon May 04 10:17:34 2015 +0900 @@ -2273,6 +2273,17 @@ <>\n<]> <>\n< +Test leading backslashes: + + $ cd latesttag + $ hg log -r 2 -T '\{rev} {files % "\{file}"} {files % r"\{file}"}\n' + {rev} {file} \head1 + $ hg log -r 2 -T '\\{rev} {files % "\\{file}"} {files % r"\\{file}"}\n' + \2 \head1 \\head1 + $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"} {files % r"\\\{file}"}\n' + \{rev} \{file} \\\head1 + $ cd .. + "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice) $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n'