Show More
@@ -797,10 +797,14 b' def ifcontains(context, mapping, args):' | |||
|
797 | 797 | raise error.ParseError(_("ifcontains expects three or four arguments")) |
|
798 | 798 | |
|
799 | 799 | haystack = evalfuncarg(context, mapping, args[1]) |
|
800 | needle = evalastype(context, mapping, args[0], | |
|
801 | getattr(haystack, 'keytype', None) or bytes) | |
|
800 | try: | |
|
801 | needle = evalastype(context, mapping, args[0], | |
|
802 | getattr(haystack, 'keytype', None) or bytes) | |
|
803 | found = (needle in haystack) | |
|
804 | except error.ParseError: | |
|
805 | found = False | |
|
802 | 806 | |
|
803 | if needle in haystack: | |
|
807 | if found: | |
|
804 | 808 | yield evalrawexp(context, mapping, args[2]) |
|
805 | 809 | elif len(args) == 4: |
|
806 | 810 | yield evalrawexp(context, mapping, args[3]) |
@@ -3948,6 +3948,9 b' Test revset function' | |||
|
3948 | 3948 | 1 match rev |
|
3949 | 3949 | 0 not match rev |
|
3950 | 3950 | |
|
3951 | $ hg log -T '{ifcontains(desc, revset(":"), "", "type not match")}\n' -l1 | |
|
3952 | type not match | |
|
3953 | ||
|
3951 | 3954 | $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n' |
|
3952 | 3955 | 2 Parents: 1 |
|
3953 | 3956 | 1 Parents: 0 |
General Comments 0
You need to be logged in to leave comments.
Login now