changeset 21404:ca275f7ec576

update: when deactivating a bookmark, print a message This helps prevent user confusion when innocent-seeming commands like 'hg update -C .' are run.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 14 May 2014 12:49:55 -0700
parents 3db723e2dc20
children dcf20f244c2a
files mercurial/commands.py tests/test-bookmarks-merge.t tests/test-bookmarks-pushpull.t tests/test-bookmarks-strip.t tests/test-bookmarks.t tests/test-commandserver.py.out tests/test-convert-hg-source.t tests/test-issue1877.t tests/test-rebase-bookmarks.t tests/test-rollback.t tests/test-subrepo-svn.t
diffstat 11 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Aug 02 13:51:34 2012 +0200
+++ b/mercurial/commands.py	Wed May 14 12:49:55 2014 -0700
@@ -5901,6 +5901,9 @@
     elif brev in repo._bookmarks:
         bookmarks.setcurrent(repo, brev)
     elif brev:
+        if repo._bookmarkcurrent:
+            ui.status(_("(leaving bookmark %s)\n") %
+                      repo._bookmarkcurrent)
         bookmarks.unsetcurrent(repo)
 
     return ret
--- a/tests/test-bookmarks-merge.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-bookmarks-merge.t	Wed May 14 12:49:55 2014 -0700
@@ -32,6 +32,7 @@
 
   $ hg up -C 3
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (leaving bookmark c)
   $ echo d > d
   $ hg add d
   $ hg commit -m'd'
@@ -54,6 +55,7 @@
 
   $ hg up -C 4
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark e)
   $ hg merge
   abort: heads are bookmarked - please merge with an explicit rev
   (run 'hg heads' to see all heads)
@@ -72,6 +74,7 @@
 
   $ hg up -C 4
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark e)
   $ echo f > f
   $ hg commit -Am "f"
   adding f
@@ -114,6 +117,7 @@
 
   $ hg up -C 6
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark e)
   $ echo g > g
   $ hg commit -Am 'g'
   adding g
--- a/tests/test-bookmarks-pushpull.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-bookmarks-pushpull.t	Wed May 14 12:49:55 2014 -0700
@@ -411,6 +411,7 @@
   $ hg commit -m 'add bar'
   $ hg co "tip^"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark @)
   $ hg book add-foo
   $ hg book -r tip add-bar
 Note: this push *must* push only a single changeset, as that's the point
--- a/tests/test-bookmarks-strip.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-bookmarks-strip.t	Wed May 14 12:49:55 2014 -0700
@@ -38,6 +38,7 @@
 
   $ hg update -r -2
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (leaving bookmark test2)
 
   $ echo eee>>qqq.txt
 
--- a/tests/test-bookmarks.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-bookmarks.t	Wed May 14 12:49:55 2014 -0700
@@ -582,6 +582,7 @@
   $ hg book should-end-on-two
   $ hg co --clean 4
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark should-end-on-two)
   $ hg book four
   $ hg --config extensions.mq= strip 3
   saved backup bundle to * (glob)
--- a/tests/test-commandserver.py.out	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-commandserver.py.out	Wed May 14 12:49:55 2014 -0700
@@ -177,6 +177,7 @@
 
  runcommand update -C 0
 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+(leaving bookmark bm3)
  runcommand commit -Am. a
 created new head
  runcommand log -Gq
--- a/tests/test-convert-hg-source.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-convert-hg-source.t	Wed May 14 12:49:55 2014 -0700
@@ -24,6 +24,7 @@
   $ hg ci -m 'merge local copy' -d '3 0'
   $ hg up -C 1
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark premerge1)
   $ hg bookmark premerge2
   $ hg merge 2
   merging foo and baz to baz
--- a/tests/test-issue1877.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-issue1877.t	Wed May 14 12:49:55 2014 -0700
@@ -34,6 +34,7 @@
   
   $ hg up 1e6c11564562
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark main)
   $ hg merge main
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
--- a/tests/test-rebase-bookmarks.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-rebase-bookmarks.t	Wed May 14 12:49:55 2014 -0700
@@ -154,6 +154,7 @@
 
   $ hg up 2
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (leaving bookmark X)
   $ echo 'C' > c
   $ hg add c
   $ hg ci -m 'other C'
--- a/tests/test-rollback.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-rollback.t	Wed May 14 12:49:55 2014 -0700
@@ -82,6 +82,7 @@
   0  default  add a again
   $ hg update default
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark foo)
   $ hg bookmark bar
   $ cat .hg/undo.branch ; echo
   test
--- a/tests/test-subrepo-svn.t	Thu Aug 02 13:51:34 2012 +0200
+++ b/tests/test-subrepo-svn.t	Wed May 14 12:49:55 2014 -0700
@@ -470,6 +470,7 @@
   $ hg book other
   $ hg co -r 'p1(tip)'
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (leaving bookmark other)
   $ echo "obstruct =        [svn]       $SVNREPOURL/src" >> .hgsub
   $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
   $ hg commit -m 'Other branch which will be obstructed'
@@ -543,6 +544,7 @@
   A    *recreated/somethingold (glob)
   Checked out revision 10.
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (leaving bookmark other)
   $ test -f recreated/somethingold
 
 Test archive