Mercurial > hg
view tests/test-mq-qsave.t @ 24966:554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
db7463aa080f fixed the issue of double escapes, but it made the following
template fail with syntax error because of <\">. Strictly speaking, <\">
appears to be invalid in non-string part, but we are likely to escape <">
if surrounded by quotes, and we are used to write such templates by trial
and error.
[templates]
sl = "{tags % \"{ifeq(tag,'tip','',label('log.tag', ' {tag}'))}\"}"
So, for backward compatibility between 2.8.1 and 3.4, a single backslash
before quotation mark is stripped only in quoted template. We don't care
for <\"> in string literal in quoted template, which never worked as expected
before.
template result
--------- ------------------------
{\"\"} parse error
"{""}" {""} -> <>
"{\"\"}" {""} -> <>
{"\""} {"\""} -> <">
'{"\""}' {"\""} -> <">
"{"\""}" parse error (don't care)
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 08 May 2015 18:11:26 +0900 |
parents | b701610f6c56 |
children | 55c6ebd11cb9 |
line wrap: on
line source
$ echo "[extensions]" >> $HGRCPATH $ echo "mq=" >> $HGRCPATH $ hg init $ echo 'base' > base $ hg ci -Ambase adding base $ hg qnew -mmqbase mqbase $ hg qsave $ hg qrestore 2 restoring status: hg patches saved state