[PATCH 1 of 6] update: omit redundant activating message for already active bookmark

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Mar 11 14:41:06 EST 2016


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1457724942 -32400
#      Sat Mar 12 04:35:42 2016 +0900
# Node ID 4895764323c150d4d34a85cde20da91250eddaf0
# Parent  f12ec4d1c784270b6d7970c159c344c2ad678843
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 @@ def update(ui, repo, node=None, rev=None
                           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 @@ list bookmarks with color
 
 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 @@ pull --update works the same as pull && 
   $ 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 @@ We warn about divergent during bare upda
   $ 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 @@ tipmost surviving ancestor of the stripp
 
 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


More information about the Mercurial-devel mailing list