##// END OF EJS Templates
merge with stable
Matt Mackall -
r25490:ad14fb60 merge default
parent child Browse files
Show More
@@ -364,12 +364,13 b' def get(context, mapping, args):'
364 364 yield dictarg.get(key)
365 365
366 366 def _evalifliteral(arg, context, mapping):
367 t = stringify(arg[0](context, mapping, arg[1]))
368 if arg[0] == runstring or arg[0] == runrawstring:
367 # get back to token tag to reinterpret string as template
368 strtoken = {runstring: 'string', runrawstring: 'rawstring'}.get(arg[0])
369 if strtoken:
369 370 yield runtemplate(context, mapping,
370 compiletemplate(t, context, strtoken='rawstring'))
371 compiletemplate(arg[1], context, strtoken))
371 372 else:
372 yield t
373 yield stringify(arg[0](context, mapping, arg[1]))
373 374
374 375 def if_(context, mapping, args):
375 376 """:if(expr, then[, else]): Conditionally execute based on the result of
@@ -2857,6 +2857,17 b' Test leading backslashes:'
2857 2857 \{rev} \{file} \\\head1
2858 2858 $ cd ..
2859 2859
2860 Test leading backslashes in "if" expression (issue4714):
2861
2862 $ cd latesttag
2863 $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n'
2864 {rev} \2
2865 $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n'
2866 \2 \\2
2867 $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n'
2868 \{rev} \\\2
2869 $ cd ..
2870
2860 2871 "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice)
2861 2872
2862 2873 $ 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