# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1457724942 -32400
#      Sat Mar 12 04:35:42 2016 +0900
# Node ID 2e1bceeea5204ef59e785093b8e5b6706ed146f4
# Parent  8b90367c4cf3892fd4bd092a320f77134beedc85
update: omit redundant activating message for already active bookmark

This patch also adds "hg bookmarks" invocation into tests, where
redundant message is omitted but bookmark activity isn't clear from
context.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -7121,8 +7121,9 @@
                           repo._activebookmark)
                 bookmarks.deactivate(repo)
         elif brev in repo._bookmarks:
+            if brev != repo._activebookmark:
+                ui.status(_("(activating bookmark %s)\n") % brev)
             bookmarks.activate(repo, brev)
-            ui.status(_("(activating bookmark %s)\n") % brev)
         elif brev:
             if repo._activebookmark:
                 ui.status(_("(leaving bookmark %s)\n") %
diff --git a/tests/test-bookmarks-current.t b/tests/test-bookmarks-current.t
--- a/tests/test-bookmarks-current.t
+++ b/tests/test-bookmarks-current.t
@@ -22,9 +22,10 @@
 
 update to bookmark X
 
+  $ hg bookmarks
+   * X                         -1:000000000000
   $ hg update X
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  (activating bookmark X)
 
 list bookmarks
 
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -599,7 +599,6 @@
   $ hg -R ../cloned-bookmarks-manual-update update
   updating to active bookmark Y
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  (activating bookmark Y)
 
 (all in one version)
 
@@ -643,7 +642,6 @@
   $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
   updating to active bookmark Y
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  (activating bookmark Y)
   1 other divergent bookmarks for "Y"
 
 test wrongly formated bookmark
@@ -738,9 +736,11 @@
 
 no-op update doesn't deactive bookmarks
 
+  $ hg bookmarks
+   * four                      3:9ba5f110a0b3
+     should-end-on-two         2:db815d6d32e6
   $ hg up four
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  (activating bookmark four)
   $ hg up
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg sum