##// END OF EJS Templates
templater: fix shortest() to evaluate int argument and handle error
Yuya Nishihara -
r28346:542d200b default
parent child Browse files
Show More
@@ -621,7 +621,9 b' def shortest(context, mapping, args):'
621
621
622 minlength = 4
622 minlength = 4
623 if len(args) > 1:
623 if len(args) > 1:
624 minlength = int(args[1][1])
624 minlength = evalinteger(context, mapping, args[1],
625 # i18n: "shortest" is a keyword
626 _("shortest() expects an integer minlength"))
625
627
626 cl = mapping['ctx']._repo.changelog
628 cl = mapping['ctx']._repo.changelog
627 def isvalid(test):
629 def isvalid(test):
@@ -3219,6 +3219,12 b' Test shortest(node) function:'
3219 $ hg log --template '{node|shortest}\n' -l1
3219 $ hg log --template '{node|shortest}\n' -l1
3220 e777
3220 e777
3221
3221
3222 $ hg log -r 0 -T '{shortest(node, "1{"0"}")}\n'
3223 f7769ec2ab
3224 $ hg log -r 0 -T '{shortest(node, "not an int")}\n'
3225 hg: parse error: shortest() expects an integer minlength
3226 [255]
3227
3222 Test pad function
3228 Test pad function
3223
3229
3224 $ hg log --template '{pad(rev, 20)} {author|user}\n'
3230 $ hg log --template '{pad(rev, 20)} {author|user}\n'
General Comments 0
You need to be logged in to leave comments. Login now