diff -r 80f423a14c90 -r fb874fc1d9b4 mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py Wed Mar 21 12:06:18 2018 +0900 +++ b/mercurial/templatefuncs.py Mon Mar 19 00:23:20 2018 +0900 @@ -291,13 +291,10 @@ # i18n: "ifcontains" is a keyword raise error.ParseError(_("ifcontains expects three or four arguments")) - haystack = evalfuncarg(context, mapping, args[1]) - keytype = getattr(haystack, 'keytype', None) + haystack = evalwrapped(context, mapping, args[1]) try: needle = evalrawexp(context, mapping, args[0]) - needle = templateutil.unwrapastype(context, mapping, needle, - keytype or bytes) - found = (needle in haystack) + found = haystack.contains(context, mapping, needle) except error.ParseError: found = False