[PATCH 3 of 3] summary: show active bookmark even if not at current changeset

Kevin Bullock kbullock+mercurial at ringworld.org
Sat Feb 9 11:54:34 CST 2013


# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1360360042 0
# Node ID 9d727e125244520c4fe60a4b8d60e29269d24af3
# Parent  04f1a301c90a00480839f8ee86c7e550a7e98f87
summary: show active bookmark even if not at current changeset

Before this change, 'hg summary' would not show the active bookmark
unless it pointed to the working directory parent. After this change, it
will show it in parentheses, like so:

parent: 18581:f0ff45fe6700 tip
 summary: simplify handling of active bookmark
branch: default
bookmarks: [crew]
commit: (clean)
update: (current)

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5574,9 +5574,12 @@ def summary(ui, repo, **opts):
         current = repo._bookmarkcurrent
         # i18n: column positioning for "hg summary"
         ui.write(_('bookmarks:'), label='log.bookmark')
-        if current is not None and current in marks:
-            ui.write(' *' + current, label='bookmarks.current')
-            marks.remove(current)
+        if current is not None:
+            if current in marks:
+                ui.write(' *' + current, label='bookmarks.current')
+                marks.remove(current)
+            else:
+                ui.write('[%s]' % current, label='bookmarks.current')
         for m in marks:
             ui.write(' ' + m, label='log.bookmark')
         ui.write('\n', label='log.bookmark')
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -471,7 +471,7 @@ update to current bookmark if it's not t
   parent: 2:db815d6d32e6 
    2
   branch: default
-  bookmarks: Y x  y
+  bookmarks:[Z] Y x  y
   commit: 1 added, 1 unknown (new branch head)
   update: 2 new changesets (update)
   $ hg update


More information about the Mercurial-devel mailing list