[PATCH 06 of 13] bookmark: make use of output labeling

Brodie Rao dackze at gmail.com
Wed Mar 31 10:00:42 CDT 2010


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1270046400 18000
# Node ID 62321a18dcc1a4feb7bbfd066e694ffdf621dccc
# Parent  4e96058a60d235e16db056581f9dac30222d8e06
bookmark: make use of output labeling

diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
--- a/hgext/bookmarks.py
+++ b/hgext/bookmarks.py
@@ -152,15 +152,22 @@ def bookmark(ui, repo, mark=None, rev=No
             for bmark, n in marks.iteritems():
                 if ui.configbool('bookmarks', 'track.current'):
                     current = repo._bookmarkcurrent
-                    prefix = (bmark == current and n == cur) and '*' or ' '
+                    if bmark == current and n == cur:
+                        prefix, label = '*', 'bookmarks.current'
+                    else:
+                        prefix, label = ' ', ''
                 else:
-                    prefix = (n == cur) and '*' or ' '
+                    if n == cur:
+                        prefix, label = '*', 'bookmarks.current'
+                    else:
+                        prefix, label = ' ', ''
 
                 if ui.quiet:
-                    ui.write("%s\n" % bmark)
+                    ui.write("%s\n" % bmark, label=label)
                 else:
                     ui.write(" %s %-25s %d:%s\n" % (
-                        prefix, bmark, repo.changelog.rev(n), hexfn(n)))
+                        prefix, bmark, repo.changelog.rev(n), hexfn(n)),
+                        label=label)
         return
 
 def _revstostrip(changelog, node):


More information about the Mercurial-devel mailing list