[PATCH 5 of 5] update: consider successor changesets when moving active bookmark
Sean Farley
sean.michael.farley at gmail.com
Wed Nov 27 15:59:30 CST 2013
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1385231413 18000
# Sat Nov 23 13:30:13 2013 -0500
# Node ID 95eddb9a2f7df8ef7d23635912d76040d59451f4
# Parent 8a2ffee6b26f399b0a04bb61e4ab2bfabc7d28a0
update: consider successor changesets when moving active bookmark
Tests have been updated and keep issue4015 covered as well.
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -195,12 +195,14 @@
old = repo[marks[cur]]
new = repo[node]
divs = [repo[b] for b in marks
if b.split('@', 1)[0] == cur.split('@', 1)[0]]
anc = repo.changelog.ancestors([new.rev()])
+ # consider successor changesets as well
+ foreground = obsolete.foreground(repo, [marks[cur]])
deletefrom = [b.node() for b in divs if b.rev() in anc or b == new]
- if old.descendant(new):
+ if old.descendant(new) or new.node() in foreground:
marks[cur] = new.node()
update = True
if deletedivergent(repo, deletefrom, cur):
update = True
diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -215,15 +215,19 @@
$ hg id --debug -i -r 4
d047485b3896813b2a624e86201983520f003206
$ hg debugobsolete 6efa171f091b00a3c35edc15d48c52a498929953 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
$ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa d047485b3896813b2a624e86201983520f003206
-Test that 5 is detected as a valid destination from 3
-
+Test that 5 is detected as a valid destination from 3 and brings its active
+bookmark along with it
$ hg up --quiet --hidden 3
+ $ hg book bm
$ hg up
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updating bookmark bm
+ $ hg book
+ * bm 5:ff252e8273df
Test that 5 is detected as a valid destination from 1 and also accepts moving
the bookmark (issue4015)
$ hg up --quiet 0 # we should be able to update to 1 directly
$ hg up --quiet 1 # but not implemented yet.
More information about the Mercurial-devel
mailing list