diff tests/test-command-template.t @ 24240:bd504d90588d

templater: implement _hybrid.__contains__ so that ifcontains can accept dict d8fb835376d1 is fine for "{revset()}", but "i.values()[0]" does not work if each item has more than one values such as "{bookmarks}". This fixes the problem by using list.__contains__ or dict.__contains__ appropriately.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 18 Feb 2015 23:01:33 +0900
parents d091f62be5ae
children e7baf88c29c3
line wrap: on
line diff
--- a/tests/test-command-template.t	Sun Mar 08 14:46:42 2015 +0900
+++ b/tests/test-command-template.t	Wed Feb 18 23:01:33 2015 +0900
@@ -47,6 +47,9 @@
   fourth (second)
   $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r .
   second -> fourth
+  $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7
+  8 t
+  7 f
 
 Quoting for ui.logtemplate
 
@@ -2386,6 +2389,10 @@
   2 bar foo
   1 baz
   0 
+  $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n"
+  2 t
+  1 f
+  0 f
 
 Test stringify on sub expressions