templatekw: fix join format of revset() function stable
authorYuya Nishihara <yuya@tcha.org>
Fri, 22 Jul 2016 22:00:46 +0900
branchstable
changeset 29623 33bf8bd8c5b9
parent 29622 9c2cc107547f
child 29624 1a129dd05b7d
templatekw: fix join format of revset() function It's been broken since e4609ec959f8, which made makemap() return a dict of multiple keywords. Because the default joinfmt() randomly picks one item from a dict, we have to make revset() select d[name] explicitly.
mercurial/templatekw.py
tests/test-command-template.t
--- a/mercurial/templatekw.py	Fri Jul 22 11:29:42 2016 +0000
+++ b/mercurial/templatekw.py	Fri Jul 22 22:00:46 2016 +0900
@@ -547,7 +547,8 @@
     revs = [str(r) for r in revs]  # ifcontains() needs a list of str
     f = _showlist(name, revs, **args)
     return _hybrid(f, revs,
-                   lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}})
+                   lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}},
+                   lambda d: d[name])
 
 @templatekeyword('subrepos')
 def showsubrepos(**args):
--- a/tests/test-command-template.t	Fri Jul 22 11:29:42 2016 +0000
+++ b/tests/test-command-template.t	Fri Jul 22 22:00:46 2016 +0900
@@ -3433,6 +3433,11 @@
   $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n'
   -1:000000000000
 
+join() should pick '{rev}' from revset items:
+
+  $ hg log -R ../a -T '{join(revset("parents(%d)", rev), ", ")}\n' -r6
+  4, 5
+
 Test active bookmark templating
 
   $ hg book foo