mercurial/templatekw.py
changeset 24240 bd504d90588d
parent 24239 31f9b1b16d1e
child 24241 e7baf88c29c3
--- a/mercurial/templatekw.py	Sun Mar 08 14:46:42 2015 +0900
+++ b/mercurial/templatekw.py	Wed Feb 18 23:01:33 2015 +0900
@@ -12,6 +12,8 @@
 # This helper class allows us to handle both:
 #  "{files}" (legacy command-line-specific list hack) and
 #  "{files % '{file}\n'}" (hgweb-style with inlining and function support)
+# and to access raw values:
+#  "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}"
 
 class _hybrid(object):
     def __init__(self, gen, values, makemap, joinfmt=None):
@@ -28,6 +30,8 @@
         makemap = self._makemap
         for x in self.values:
             yield makemap(x)
+    def __contains__(self, x):
+        return x in self.values
     def __len__(self):
         return len(self.values)