Mercurial > hg-stable
changeset 28274:5d9578d9ad1a
pull: deactivate a bookmark not matching with the destination of the update
Before this patch, "hg pull -u" with a target doesn't deactivate a current
active bookmark, which doesn't match with the explicit destination of the
update, even though bare "hg update" does so.
A "target" can be provided through:
- option --rev ANOTHER
- option --branch ANOTHER
- source URL#ANOTHER
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 26 Feb 2016 20:22:05 +0900 |
parents | 9ac8955d8c45 |
children | d4cced5885f8 |
files | mercurial/commands.py tests/test-pull-update.t |
diffstat | 2 files changed, 93 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Feb 26 20:22:05 2016 +0900 +++ b/mercurial/commands.py Fri Feb 26 20:22:05 2016 +0900 @@ -5570,6 +5570,11 @@ 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())
--- a/tests/test-pull-update.t Fri Feb 26 20:22:05 2016 +0900 +++ b/tests/test-pull-update.t Fri Feb 26 20:22:05 2016 +0900 @@ -123,4 +123,92 @@ * active-after-pull 4:f815b3da6163 active-before-pull 3:483b76ad4309 +(discard pulled changes) + + $ hg update -q 483b76ad4309 + $ hg rollback -q + +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. + + $ cd ../t + $ hg bookmark -d active-after-pull + $ hg branch bar -q + $ hg commit -m "#5 (bar #1)" + $ cd ../tt + +(1) deactivating by --rev REV + + $ hg bookmark -f active-before-pull + $ hg bookmarks + * active-before-pull 3:483b76ad4309 + + $ hg pull -u -r b5e4babfaaa7 + pulling from $TESTTMP/t (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 1 changes to 1 files + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (leaving bookmark active-before-pull) + + $ hg parents -q + 5:b5e4babfaaa7 + $ hg bookmarks + active-before-pull 3:483b76ad4309 + +(discard pulled changes) + + $ hg update -q 483b76ad4309 + $ hg rollback -q + +(2) deactivating by --branch BRANCH + + $ hg bookmark -f active-before-pull + $ hg bookmarks + * active-before-pull 3:483b76ad4309 + + $ hg pull -u -b bar + pulling from $TESTTMP/t (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 1 changes to 1 files + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (leaving bookmark active-before-pull) + + $ hg parents -q + 5:b5e4babfaaa7 + $ hg bookmarks + active-before-pull 3:483b76ad4309 + +(discard pulled changes) + + $ hg update -q 483b76ad4309 + $ hg rollback -q + +(3) deactivating by URL#ANOTHER-BRANCH + + $ 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 1 changes to 1 files + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (leaving bookmark active-before-pull) + + $ hg parents -q + 5:b5e4babfaaa7 + $ hg bookmarks + active-before-pull 3:483b76ad4309 + $ cd ..