[PATCH] commands: move bookmark on pull -u and unbundle -u (issue3222)
Matt Mackall
mpm at selenic.com
Sun Jan 29 19:46:18 UTC 2012
On Sat, 2012-01-28 at 09:41 -0600, Kevin Bullock wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock at ringworld.org>
> # Date 1327719704 21600
> # Branch stable
> # Node ID 194ad854aa881820c0656da23b63c91dd342a1d0
> # Parent f2c49d9dee5783fa3a3aad76f56e9bbc60e88585
> commands: move bookmark on pull -u and unbundle -u (issue3222)
I don't think this patch matches the "if no revs specified" behavior of
update. Also, it's a bit more complicated as there are several cases:
a) hg pull -u <- should move bookmark
b) hg pull -u -r default <- should not
c) hg pull -u -b default <- should not
d) hg pull -u http://repo#stable <- probably not?
e) hg pull -u # default path = http://repo#stable <- probably?
Note that (d) and (e) are defined as being identical to (b)/(c).
Trouble is, we have a hard time distinguishing (c) and (e) by the time
we get to postincoming. For now, we should probably implement (a)
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4261,7 +4261,12 @@ def postincoming(ui, repo, modheads, opt
> return
> if optupdate:
> try:
> - return hg.update(repo, checkout)
> + # if updating, move the current bookmark, if any
> + movemarkfrom = repo['.'].node()
> + ret = hg.update(repo, checkout)
> + if not ret:
> + bookmarks.update(repo, [movemarkfrom], repo['.'].node())
> + return ret
> except util.Abort, inst:
> ui.warn(_("not updating: %s\n" % str(inst)))
> return 0
> diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
> --- a/tests/test-bookmarks-pushpull.t
> +++ b/tests/test-bookmarks-pushpull.t
> @@ -197,3 +197,59 @@ hgweb
> foobar 1:9b140be10808
>
> $ kill `cat ../hg.pid`
> +
> +move current bookmark on pull -u
> +
> + $ hg up 2
> + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
> + $ echo c3 > f3
> + $ hg ci -Am3
> + adding f3
> + $ cd ../b
> + $ hg book
> + * X 1:9b140be10808
> + X at foo 2:0d2164f0ce0d
> + Y 0:4e3505fd9583
> + Z 2:0d2164f0ce0d
> + foo -1:000000000000
> + foobar 1:9b140be10808
> + $ hg up foobar
> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> + $ hg pull -u ../a
> + pulling from ../a
> + searching for changes
> + adding changesets
> + adding manifests
> + adding file changes
> + added 1 changesets with 1 changes to 1 files
> + divergent bookmark X stored as X at 1
> + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> + $ hg book
> + X 1:9b140be10808
> + X at 1 2:0d2164f0ce0d
> + X at foo 2:0d2164f0ce0d
> + Y 0:4e3505fd9583
> + Z 2:0d2164f0ce0d
> + foo -1:000000000000
> + * foobar 3:f140e40b64d9
> +
> +move current bookmark on unbundle -u
> +
> + $ hg rollback
> + repository tip rolled back to revision 2 (undo pull)
> + working directory now based on revision 1
> + $ hg up -C foobar
> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> + $ hg -R ../a bundle -r3 - . | hg unbundle -u -
> + adding changesets
> + adding manifests
> + adding file changes
> + added 1 changesets with 1 changes to 1 files
> + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> + $ hg book
> + X 1:9b140be10808
> + X at foo 2:0d2164f0ce0d
> + Y 0:4e3505fd9583
> + Z 2:0d2164f0ce0d
> + foo -1:000000000000
> + * foobar 3:f140e40b64d9
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list