diff mercurial/templater.py @ 28332:e91371633127

templater: fix ifcontains() to evaluate items argument eagerly See the previous patch for why. An "items" argument may be a string, a generator, or an arbitrary container object.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 14 Feb 2016 00:18:12 +0900
parents 2874db5462d3
children 41373244f4e5
line wrap: on
line diff
--- a/mercurial/templater.py	Sun Feb 14 00:05:58 2016 +0900
+++ b/mercurial/templater.py	Sun Feb 14 00:18:12 2016 +0900
@@ -466,7 +466,7 @@
         raise error.ParseError(_("ifcontains expects three or four arguments"))
 
     item = stringify(args[0][0](context, mapping, args[0][1]))
-    items = args[1][0](context, mapping, args[1][1])
+    items = evalfuncarg(context, mapping, args[1])
 
     if item in items:
         yield args[2][0](context, mapping, args[2][1])