update: omit redundant activating message for already active bookmark
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sat, 12 Mar 2016 04:35:42 +0900
changeset 28500 2e1bceeea520
parent 28499 8b90367c4cf3
child 28501 66513f6ca038
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.
mercurial/commands.py
tests/test-bookmarks-current.t
tests/test-bookmarks.t
--- a/mercurial/commands.py	Fri Mar 11 11:44:03 2016 -0800
+++ b/mercurial/commands.py	Sat Mar 12 04:35:42 2016 +0900
@@ -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") %
--- a/tests/test-bookmarks-current.t	Fri Mar 11 11:44:03 2016 -0800
+++ b/tests/test-bookmarks-current.t	Sat Mar 12 04:35:42 2016 +0900
@@ -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
 
--- a/tests/test-bookmarks.t	Fri Mar 11 11:44:03 2016 -0800
+++ b/tests/test-bookmarks.t	Sat Mar 12 04:35:42 2016 +0900
@@ -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