changeset 29623:33bf8bd8c5b9 stable

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.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 22 Jul 2016 22:00:46 +0900
parents 9c2cc107547f
children 1a129dd05b7d
files mercurial/templatekw.py tests/test-command-template.t
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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