[PATCH 6 of 6 V2] update: consider successor changesets when moving active bookmark
Sean Farley
sean.michael.farley at gmail.com
Sun Jan 12 22:25:54 UTC 2014
# 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 e09e508686fc6cbc1cc53f161b72d0f20e16d58e
# Parent e24232bda6e709274ba1e1007b8dbdd04c10ab29
update: consider successor changesets when moving active bookmark
Previously, when an obsolete changeset was bookmarked, successor changesets
were not considered when moving the bookmark forward. Now that a bare update
will move to the branchtip of the successor changesets, we also update the
bookmark logic to allow the bookmark to move with this update.
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 @@ def update(repo, parents, node):
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 @@ We add simple obsolescence marker betwee
$ 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