summary: show bookmarks separate from tags and note active mark (issue2892)
authorAugie Fackler <durin42@gmail.com>
Mon, 18 Jul 2011 07:53:26 -0500
changeset 14906 7c3c8f37e84f
parent 14905 207935cda6dc
child 14907 84af56cc673b
summary: show bookmarks separate from tags and note active mark (issue2892)
mercurial/commands.py
tests/test-bookmarks.t
--- a/mercurial/commands.py	Wed Jul 20 18:23:06 2011 -0400
+++ b/mercurial/commands.py	Mon Jul 18 07:53:26 2011 -0500
@@ -4720,6 +4720,7 @@
     ctx = repo[None]
     parents = ctx.parents()
     pnode = parents[0].node()
+    marks = []
 
     for p in parents:
         # label with log.changeset (instead of log.parent) since this
@@ -4728,7 +4729,7 @@
                  label='log.changeset')
         ui.write(' '.join(p.tags()), label='log.tag')
         if p.bookmarks():
-            ui.write(' ' + ' '.join(p.bookmarks()), label='log.bookmark')
+            marks.extend(p.bookmarks())
         if p.rev() == -1:
             if not len(repo):
                 ui.write(_(' (empty repository)'))
@@ -4747,6 +4748,17 @@
     else:
         ui.status(m, label='log.branch')
 
+    if marks:
+        current = repo._bookmarkcurrent
+        if current is not None:
+            try:
+                marks.remove(current)
+                marks = ['*' + current] + marks
+            except ValueError:
+                # current bookmark not in parent ctx marks
+                pass
+        ui.write(_('bookmarks: %s\n') % ' '.join(marks), label='log.bookmark')
+
     st = list(repo.status(unknown=True))[:6]
 
     c = repo.dirstate.copies()
--- a/tests/test-bookmarks.t	Wed Jul 20 18:23:06 2011 -0400
+++ b/tests/test-bookmarks.t	Mon Jul 18 07:53:26 2011 -0500
@@ -239,9 +239,10 @@
 test summary
 
   $ hg summary
-  parent: 2:db815d6d32e6 tip Y Z x  y
+  parent: 2:db815d6d32e6 tip
    2
   branch: default
+  bookmarks: *Z Y x  y
   commit: (clean)
   update: 1 new changesets, 2 branch heads (merge)