comparison mercurial/templater.py @ 22843:b6531d806de8 stable

templater: fix ifcontains when list is a string (issue4399)
author Matt Mackall <mpm@selenic.com>
date Fri, 10 Oct 2014 11:38:00 -0500
parents 2896d450fec4
children 1533e642262d
comparison
equal deleted inserted replaced
22842:d43d116a118c 22843:b6531d806de8
310 item = stringify(args[0][0](context, mapping, args[0][1])) 310 item = stringify(args[0][0](context, mapping, args[0][1]))
311 items = args[1][0](context, mapping, args[1][1]) 311 items = args[1][0](context, mapping, args[1][1])
312 312
313 # Iterating over items gives a formatted string, so we iterate 313 # Iterating over items gives a formatted string, so we iterate
314 # directly over the raw values. 314 # directly over the raw values.
315 if item in [i.values()[0] for i in items()]: 315 if ((callable(items) and item in [i.values()[0] for i in items()]) or
316 (isinstance(items, str) and item in items)):
316 yield _evalifliteral(args[2], context, mapping) 317 yield _evalifliteral(args[2], context, mapping)
317 elif len(args) == 4: 318 elif len(args) == 4:
318 yield _evalifliteral(args[3], context, mapping) 319 yield _evalifliteral(args[3], context, mapping)
319 320
320 def ifeq(context, mapping, args): 321 def ifeq(context, mapping, args):