Comments
Patch
@@ -5570,6 +5570,11 @@ def postincoming(ui, repo, modheads, opt
if brev != repo._activebookmark:
ui.status(_("(activating bookmark %s)\n") % brev)
bookmarks.activate(repo, brev)
+ elif brev:
+ if repo._activebookmark:
+ ui.status(_("(leaving bookmark %s)\n") %
+ repo._activebookmark)
+ bookmarks.deactivate(repo)
return ret
if modheads > 1:
currentbranchheads = len(repo.branchheads())
@@ -200,6 +200,95 @@ explicit destination of the update.
active-before-pull 4:20a3d5b6ab59
* bookmark-on-bar-tip 6:0c90a742bd4f
+Test that updating deactivates current active bookmark, if the
+destination of the update is explicitly specified, and it doesn't
+match with the name of any exsiting bookmarks.
+
+(discard pulled changes)
+
+ $ hg update -q 20a3d5b6ab59
+ $ hg rollback -q
+
+(1) deactivating by --rev REV
+
+ $ hg bookmark -f active-before-pull
+ $ hg bookmarks
+ * active-before-pull 4:20a3d5b6ab59
+
+ $ hg pull -u -r 0c90a742bd4f
+ pulling from $TESTTMP/t (glob)
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 2 changes to 1 files
+ adding remote bookmark bookmark-on-bar-tip
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (leaving bookmark active-before-pull)
+
+ $ hg parents -q
+ 6:0c90a742bd4f
+ $ hg bookmarks
+ active-before-pull 4:20a3d5b6ab59
+ bookmark-on-bar-tip 6:0c90a742bd4f
+
+(discard changes pulled)
+
+ $ hg update -q 20a3d5b6ab59
+ $ hg rollback -q
+
+(2) deactivating by --branch BRANCH
+
+ $ hg bookmark -f active-before-pull
+ $ hg bookmarks
+ * active-before-pull 4:20a3d5b6ab59
+
+ $ hg pull -u -b bar
+ pulling from $TESTTMP/t (glob)
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 2 changes to 1 files
+ adding remote bookmark bookmark-on-bar-tip
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (leaving bookmark active-before-pull)
+
+ $ hg parents -q
+ 6:0c90a742bd4f
+ $ hg bookmarks
+ active-before-pull 4:20a3d5b6ab59
+ bookmark-on-bar-tip 6:0c90a742bd4f
+
+(discard changes pulled)
+
+ $ hg update -q 20a3d5b6ab59
+ $ hg rollback -q
+
+(3) deactivating by URL#ANOTHER-BRANCH
+
+ $ hg update -q default
+ $ hg bookmark -f active-before-pull
+ $ hg bookmarks
+ * active-before-pull 3:483b76ad4309
+
+ $ hg pull -u $TESTTMP/t#bar
+ pulling from $TESTTMP/t (glob)
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 2 changes to 1 files
+ adding remote bookmark bookmark-on-bar-tip
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (leaving bookmark active-before-pull)
+
+ $ hg parents -q
+ 6:0c90a742bd4f
+ $ hg bookmarks
+ active-before-pull 3:483b76ad4309
+ bookmark-on-bar-tip 6:0c90a742bd4f
+
Test updating for multiple heads:
$ hg -R ../t update -q 20a3d5b6ab59
@@ -242,6 +331,11 @@ update", if pulling even from "URL#BRANC
(2) update to "branch tip" on another topological branch, otherwise
+ $ hg bookmark -f active-before-pull
+ $ hg bookmarks
+ * active-before-pull 6:0c90a742bd4f
+ bookmark-on-bar-tip 6:0c90a742bd4f
+
$ hg pull -u -r bar
pulling from $TESTTMP/t (glob)
searching for changes
@@ -250,8 +344,12 @@ update", if pulling even from "URL#BRANC
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (leaving bookmark active-before-pull)
$ hg parents -q
7:424b5eb9b087
+ $ hg bookmarks
+ active-before-pull 6:0c90a742bd4f
+ bookmark-on-bar-tip 6:0c90a742bd4f
$ cd ..