Show More
@@ -87,8 +87,9 b' def compiletemplate(tmpl, context, strto' | |||||
87 | if n < 0: |
|
87 | if n < 0: | |
88 | parsed.append((strtoken, tmpl[pos:])) |
|
88 | parsed.append((strtoken, tmpl[pos:])) | |
89 | break |
|
89 | break | |
90 | if n > 0 and tmpl[n - 1] == '\\': |
|
90 | bs = (n - pos) - len(tmpl[pos:n].rstrip('\\')) | |
91 | # escaped |
|
91 | if strtoken == 'string' and bs % 2 == 1: | |
|
92 | # escaped (e.g. '\{', '\\\{', but not '\\{' nor r'\{') | |||
92 | parsed.append((strtoken, (tmpl[pos:n - 1] + "{"))) |
|
93 | parsed.append((strtoken, (tmpl[pos:n - 1] + "{"))) | |
93 | pos = n + 1 |
|
94 | pos = n + 1 | |
94 | continue |
|
95 | continue |
@@ -2273,6 +2273,17 b' Test string escaping:' | |||||
2273 | <>\n<]> |
|
2273 | <>\n<]> | |
2274 | <>\n< |
|
2274 | <>\n< | |
2275 |
|
2275 | |||
|
2276 | Test leading backslashes: | |||
|
2277 | ||||
|
2278 | $ cd latesttag | |||
|
2279 | $ hg log -r 2 -T '\{rev} {files % "\{file}"} {files % r"\{file}"}\n' | |||
|
2280 | {rev} {file} \head1 | |||
|
2281 | $ hg log -r 2 -T '\\{rev} {files % "\\{file}"} {files % r"\\{file}"}\n' | |||
|
2282 | \2 \head1 \\head1 | |||
|
2283 | $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"} {files % r"\\\{file}"}\n' | |||
|
2284 | \{rev} \{file} \\\head1 | |||
|
2285 | $ cd .. | |||
|
2286 | ||||
2276 | "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice) |
|
2287 | "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice) | |
2277 |
|
2288 | |||
2278 | $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n' |
|
2289 | $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n' |
General Comments 0
You need to be logged in to leave comments.
Login now