Show More
@@ -296,7 +296,7 b' def join(context, mapping, args):' | |||||
296 |
|
296 | |||
297 | joiner = " " |
|
297 | joiner = " " | |
298 | if len(args) > 1: |
|
298 | if len(args) > 1: | |
299 | joiner = args[1][0](context, mapping, args[1][1]) |
|
299 | joiner = stringify(args[1][0](context, mapping, args[1][1])) | |
300 |
|
300 | |||
301 | first = True |
|
301 | first = True | |
302 | for x in joinset: |
|
302 | for x in joinset: | |
@@ -328,9 +328,9 b' def strip(context, mapping, args):' | |||||
328 | if not (1 <= len(args) <= 2): |
|
328 | if not (1 <= len(args) <= 2): | |
329 | raise error.ParseError(_("strip expects one or two arguments")) |
|
329 | raise error.ParseError(_("strip expects one or two arguments")) | |
330 |
|
330 | |||
331 | text = args[0][0](context, mapping, args[0][1]) |
|
331 | text = stringify(args[0][0](context, mapping, args[0][1])) | |
332 | if len(args) == 2: |
|
332 | if len(args) == 2: | |
333 | chars = args[1][0](context, mapping, args[1][1]) |
|
333 | chars = stringify(args[1][0](context, mapping, args[1][1])) | |
334 | return text.strip(chars) |
|
334 | return text.strip(chars) | |
335 | return text.strip() |
|
335 | return text.strip() | |
336 |
|
336 |
@@ -1659,3 +1659,12 b' Test branches inside if statement:' | |||||
1659 |
|
1659 | |||
1660 | $ hg log -r 0 --template '{if(branches, "yes", "no")}\n' |
|
1660 | $ hg log -r 0 --template '{if(branches, "yes", "no")}\n' | |
1661 | no |
|
1661 | no | |
|
1662 | ||||
|
1663 | $ cd .. | |||
|
1664 | ||||
|
1665 | Test stringify on sub expressions | |||
|
1666 | ||||
|
1667 | $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n' | |||
|
1668 | fourth, second, third | |||
|
1669 | $ hg log -R a -r 8 --template '{strip(if("1", if("1", "-abc-")), if("1", if("1", "-")))}\n' | |||
|
1670 | abc |
General Comments 0
You need to be logged in to leave comments.
Login now