--- a/tests/test-command-template.t Tue May 05 11:15:17 2015 -0700
+++ b/tests/test-command-template.t Mon May 04 09:54:01 2015 +0900
@@ -2250,6 +2250,29 @@
<>\n<]>
<>\n<
+ $ hg log -R latesttag -r 0 \
+ > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
+ >
+ <>\n<[>
+ <>\n<]>
+ <>\n<
+
+ $ hg log -R latesttag -r 0 -T esc \
+ > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
+ >
+ <>\n<[>
+ <>\n<]>
+ <>\n<
+
+ $ cat <<'EOF' > esctmpl
+ > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
+ > EOF
+ $ hg log -R latesttag -r 0 --style ./esctmpl
+ >
+ <>\n<[>
+ <>\n<]>
+ <>\n<
+
"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'