Mercurial > hg-stable
diff mercurial/bookmarks.py @ 19110:741d94aa92e4 stable
bookmarks: resolve divergent bookmarks when moving active bookmark forward
This patch resolves divergent bookmarks between the current active bookmark
MARK and the new destination. This situation can arise when pulling new
changesets, abandoning your current changesets actively bookmarked with MARK
via strip, and then doing a bare update. The non-divergent but active bookmark
MARK is then moved to a common ancestor of the new changesets and the abandoned
changesets.
Test coverage is added.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Wed, 01 May 2013 15:34:45 -0500 |
parents | efef056b1ae9 |
children | f37b5a17e6a0 |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Wed May 01 15:31:39 2013 -0500 +++ b/mercurial/bookmarks.py Wed May 01 15:34:45 2013 -0500 @@ -171,6 +171,7 @@ return deleted def update(repo, parents, node): + deletefrom = parents marks = repo._bookmarks update = False cur = repo._bookmarkcurrent @@ -180,11 +181,15 @@ if marks[cur] in parents: 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()]) + deletefrom = [b.node() for b in divs if b.rev() in anc or b == new] if old.descendant(new): marks[cur] = new.node() update = True - if deletedivergent(repo, parents, cur): + if deletedivergent(repo, deletefrom, cur): update = True if update: