Patchwork [1,of,2] summary: simplify handling of active bookmark

login
register
mail settings
Submitter Kevin Bullock
Date Jan. 27, 2013, 6:09 p.m.
Message ID <a367f06d8c96c2279c50.1359310194@slower-than-infinity.lan>
Download mbox | patch
Permalink /patch/745/
State Superseded
Commit b1e949f6c17d8de5b145fa1e3f9d4de80f2039d0
Headers show

Comments

Kevin Bullock - Jan. 27, 2013, 6:09 p.m.
# HG changeset patch
# User Kevin Bullock <kbullock@ringworld.org>
# Date 1359309226 21600
# Branch stable
# Node ID a367f06d8c96c2279c500a688ab4ff65ac278b16
# Parent  5ef3c7081008f7befb57b10b2fa67c0d8a5e4a23
summary: simplify handling of active bookmark

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5574,13 +5574,9 @@  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:
-            try:
-                marks.remove(current)
-                ui.write(' *' + current, label='bookmarks.current')
-            except ValueError:
-                # current bookmark not in parent ctx marks
-                pass
+        if current is not None and current in marks:
+            ui.write(' *' + current, label='bookmarks.current')
+            marks.remove(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
@@ -461,6 +461,13 @@  create bundle with two heads
 
 update to current bookmark if it's not the parent
 
+  $ hg summary
+  parent: 2:db815d6d32e6 
+   2
+  branch: default
+  bookmarks: Y x  y
+  commit: 1 added, 1 unknown (new branch head)
+  update: 2 new changesets (update)
   $ hg update
   updating to active bookmark Z
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved