Show More
@@ -398,7 +398,9 b' def pad(context, mapping, args):' | |||||
398 | # i18n: "pad" is a keyword |
|
398 | # i18n: "pad" is a keyword | |
399 | raise error.ParseError(_("pad() expects two to four arguments")) |
|
399 | raise error.ParseError(_("pad() expects two to four arguments")) | |
400 |
|
400 | |||
401 | width = int(args[1][1]) |
|
401 | width = evalinteger(context, mapping, args[1], | |
|
402 | # i18n: "pad" is a keyword | |||
|
403 | _("pad() expects an integer width")) | |||
402 |
|
404 | |||
403 | text = stringify(args[0][0](context, mapping, args[0][1])) |
|
405 | text = stringify(args[0][0](context, mapping, args[0][1])) | |
404 |
|
406 |
@@ -3244,6 +3244,14 b' Test template string in pad function' | |||||
3244 | $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n' |
|
3244 | $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n' | |
3245 | \{rev} test |
|
3245 | \{rev} test | |
3246 |
|
3246 | |||
|
3247 | Test width argument passed to pad function | |||
|
3248 | ||||
|
3249 | $ hg log -r 0 -T '{pad(rev, "1{"0"}")} {author|user}\n' | |||
|
3250 | 0 test | |||
|
3251 | $ hg log -r 0 -T '{pad(rev, "not an int")}\n' | |||
|
3252 | hg: parse error: pad() expects an integer width | |||
|
3253 | [255] | |||
|
3254 | ||||
3247 | Test ifcontains function |
|
3255 | Test ifcontains function | |
3248 |
|
3256 | |||
3249 | $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n' |
|
3257 | $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n' |
General Comments 0
You need to be logged in to leave comments.
Login now