templatekw: fix {join(bookmarks, sep)} to always show associated bookmarks stable
authorYuya Nishihara <yuya@tcha.org>
Wed, 18 Feb 2015 22:17:35 +0900
branchstable
changeset 24157 d091f62be5ae
parent 24156 75a2df2bbde8
child 24158 d414c28db84d
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.
mercurial/templatekw.py
tests/test-command-template.t
--- 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