# HG changeset patch # User Yuya Nishihara # Date 1433756925 -32400 # Node ID 576d6c74784bb429ec15deece9d00642aa9f7b1e # Parent b8fd605b0c88ee63641841ad3f675e71f9f02673 templater: make pad function evaluate both string and rawstring templates "pad" function and "rawstring" type were introduced in parallel, aa51392da507 in default and 5ab28a2e9962 in stable respectively. Therefore, "pad" function lacked handling of "rawstring" unintentionally. diff -r b8fd605b0c88 -r 576d6c74784b mercurial/templater.py --- a/mercurial/templater.py Sat Jun 06 22:10:18 2015 -0400 +++ b/mercurial/templater.py Mon Jun 08 18:48:45 2015 +0900 @@ -310,10 +310,7 @@ width = int(args[1][1]) - text = stringify(args[0][0](context, mapping, args[0][1])) - if args[0][0] == runstring: - text = stringify(runtemplate(context, mapping, - compiletemplate(text, context))) + text = stringify(_evalifliteral(args[0], context, mapping)) right = False fillchar = ' ' diff -r b8fd605b0c88 -r 576d6c74784b tests/test-command-template.t --- a/tests/test-command-template.t Sat Jun 06 22:10:18 2015 -0400 +++ b/tests/test-command-template.t Mon Jun 08 18:48:45 2015 +0900 @@ -3042,6 +3042,14 @@ 1------------------- {node|short} 0------------------- test +Test template string in pad function + + $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n' + {0} test + + $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n' + \0 test + Test ifcontains function $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n'