changeset 24157:d091f62be5ae stable

templatekw: fix {join(bookmarks, sep)} to always show associated bookmarks The default joinfmt, "x.values()[0]", can't be used here because it picks either 'bookmark' or 'current' randomly. I got wrong result with PYTHONHASHSEED=1 on my amd64 machine.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 18 Feb 2015 22:17:35 +0900
parents 75a2df2bbde8
children d414c28db84d
files mercurial/templatekw.py tests/test-command-template.t
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Wed Feb 18 22:10:17 2015 +0900
+++ b/mercurial/templatekw.py	Wed Feb 18 22:17:35 2015 +0900
@@ -202,7 +202,7 @@
     current = repo._bookmarkcurrent
     c = [{'bookmark': x, 'current': current} for x in bookmarks]
     f = _showlist('bookmark', bookmarks, **args)
-    return _hybrid(f, c)
+    return _hybrid(f, c, lambda x: x['bookmark'])
 
 def showchildren(**args):
     """:children: List of strings. The children of the changeset."""
--- a/tests/test-command-template.t	Wed Feb 18 22:10:17 2015 +0900
+++ b/tests/test-command-template.t	Wed Feb 18 22:17:35 2015 +0900
@@ -2381,6 +2381,11 @@
   2 
   1 
   0 
+  $ hg book -r1 baz
+  $ hg log --template "{rev} {join(bookmarks, ' ')}\n"
+  2 bar foo
+  1 baz
+  0 
 
 Test stringify on sub expressions