diff tests/test-command-template.t @ 38267:fb874fc1d9b4

templater: abstract ifcontains() over wrapped types This allows us to make .keytype private. There's a minor BC that a hybrid dict/list of keytype=None now strictly checks the type of the needle. For example, {ifcontains(rev, files)} no longer matches a file named "1" at the rev=1. I made this change for consistency with the get(dict, key) function. We can restore the old behavior by making keytype=bytes the default if desired.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 19 Mar 2018 00:23:20 +0900
parents 41ae9b3cbfb9
children 4b0f39e7406e
line wrap: on
line diff
--- a/tests/test-command-template.t	Wed Mar 21 12:06:18 2018 +0900
+++ b/tests/test-command-template.t	Mon Mar 19 00:23:20 2018 +0900
@@ -4166,6 +4166,15 @@
   1
   0
 
+  $ hg log -l1 -T '{ifcontains("branch", extras, "t", "f")}\n'
+  t
+  $ hg log -l1 -T '{ifcontains("branch", extras % "{key}", "t", "f")}\n'
+  t
+  $ hg log -l1 -T '{ifcontains("branc", extras % "{key}", "t", "f")}\n'
+  f
+  $ hg log -l1 -T '{ifcontains("branc", stringify(extras % "{key}"), "t", "f")}\n'
+  t
+
 Test revset function
 
   $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n'