Patchwork [1,of,2,STABLE] templatekw: inline showlist() into showbookmarks()

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 18, 2015, 3:17 p.m.
Message ID <7cd913864fd52bbd2823.1424272623@mimosa>
Download mbox | patch
Permalink /patch/7807/
State Accepted
Commit 75a2df2bbde8d4e27b6492a3dd2290bfad230b1e
Delegated to: Augie Fackler
Headers show

Comments

Yuya Nishihara - Feb. 18, 2015, 3:17 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1424265017 -32400
#      Wed Feb 18 22:10:17 2015 +0900
# Branch stable
# Node ID 7cd913864fd52bbd28236db7e47c871dd83f5737
# Parent  942a5a34b2d0611ab284380fbe45b9bb1897af98
templatekw: inline showlist() into showbookmarks()

showlist() is the helper to build _hybrid object from a trivial list. It can't
be applied if each value has more than one items, 'bookmark' and 'current' in
this case.

This change is necessary to fix random failure of "{join(bookmarks, sep)}".

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -199,10 +199,10 @@  def showbookmarks(**args):
     """
     repo = args['ctx']._repo
     bookmarks = args['ctx'].bookmarks()
-    hybrid = showlist('bookmark', bookmarks, **args)
-    for value in hybrid.values:
-        value['current'] = repo._bookmarkcurrent
-    return hybrid
+    current = repo._bookmarkcurrent
+    c = [{'bookmark': x, 'current': current} for x in bookmarks]
+    f = _showlist('bookmark', bookmarks, **args)
+    return _hybrid(f, c)
 
 def showchildren(**args):
     """:children: List of strings. The children of the changeset."""