Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 19111:6439d78e14fb stable
bookmarks: resolve divergent bookmark when moving across a branch
This patch resolves a single divergent bookmark if a divergent bookmark exists
in the target revision and it current bookmark is not an ancestor of the target
revision, else it would already be handled by the previous patch in this
series.
Test coverage is added.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Tue, 30 Apr 2013 21:12:49 -0500 |
parents | 26c51e87e807 |
children | 23f785b38af3 |
comparison
equal
deleted
inserted
replaced
19110:741d94aa92e4 | 19111:6439d78e14fb |
---|---|
816 return | 816 return |
817 anc = repo.changelog.ancestors([repo[target].rev()]) | 817 anc = repo.changelog.ancestors([repo[target].rev()]) |
818 bmctx = repo[marks[mark]] | 818 bmctx = repo[marks[mark]] |
819 divs = [repo[b].node() for b in marks | 819 divs = [repo[b].node() for b in marks |
820 if b.split('@', 1)[0] == mark.split('@', 1)[0]] | 820 if b.split('@', 1)[0] == mark.split('@', 1)[0]] |
821 | |
822 # allow resolving a single divergent bookmark even if moving | |
823 # the bookmark across branches when a revision is specified | |
824 # that contains a divergent bookmark | |
825 if bmctx.rev() not in anc and target in divs: | |
826 bookmarks.deletedivergent(repo, [target], mark) | |
827 return | |
828 | |
821 deletefrom = [b for b in divs | 829 deletefrom = [b for b in divs |
822 if repo[b].rev() in anc or b == target] | 830 if repo[b].rev() in anc or b == target] |
823 bookmarks.deletedivergent(repo, deletefrom, mark) | 831 bookmarks.deletedivergent(repo, deletefrom, mark) |
824 if bmctx.rev() in anc: | 832 if bmctx.rev() in anc: |
825 ui.status(_("moving bookmark '%s' forward from %s\n") % | 833 ui.status(_("moving bookmark '%s' forward from %s\n") % |