diff tests/test-command-template.t @ 34534:b3073e175c17

templater: wrap get/min/max result so map operation can apply to element See the test for usage example. wraphybridvalue() takes a key/value pair because a hybrid dict passes a key to its makemap() function. Since makemap() of showmanifest() doesn't need a key, it's set to None.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 09 Sep 2017 19:13:25 +0900
parents 89aec1834a86
children 78590585c0db
line wrap: on
line diff
--- a/tests/test-command-template.t	Mon Oct 02 07:18:24 2017 +0100
+++ b/tests/test-command-template.t	Sat Sep 09 19:13:25 2017 +0900
@@ -3128,10 +3128,24 @@
   $ hg log -R latesttag -r tip -T '{manifest % "{rev}:{node}"}\n'
   11:2bc6e9006ce29882383a22d39fd1f4e66dd3e2fc
 
-Test manifest can be join()-ed as before, though it's silly:
+  $ hg log -R latesttag -r tip -T '{get(extras, "branch") % "{key}: {value}\n"}'
+  branch: default
+  $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "{key}\n"}'
+  hg: parse error: None is not iterable
+  [255]
+  $ hg log -R latesttag -r tip -T '{min(extras) % "{key}: {value}\n"}'
+  branch: default
+  $ hg log -R latesttag -l1 -T '{min(revset("0:9")) % "{rev}:{node|short}\n"}'
+  0:ce3cec86e6c2
+  $ hg log -R latesttag -l1 -T '{max(revset("0:9")) % "{rev}:{node|short}\n"}'
+  9:fbc7cd862e9c
+
+Test manifest/get() can be join()-ed as before, though it's silly:
 
   $ hg log -R latesttag -r tip -T '{join(manifest, "")}\n'
   11:2bc6e9006ce2
+  $ hg log -R latesttag -r tip -T '{join(get(extras, "branch"), "")}\n'
+  default
 
 Test the sub function of templating for expansion: