diff --git a/mercurial/commands.py b/mercurial/commands.py index cb95716da5fe37a9bd6a8c7da73dc6caf89d5fe7_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..26c51e87e807d085a24cc9f2321c75faaa0c7ff4_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644 --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -816,6 +816,11 @@ return anc = repo.changelog.ancestors([repo[target].rev()]) bmctx = repo[marks[mark]] + divs = [repo[b].node() for b in marks + if b.split('@', 1)[0] == mark.split('@', 1)[0]] + deletefrom = [b for b in divs + if repo[b].rev() in anc or b == target] + bookmarks.deletedivergent(repo, deletefrom, mark) if bmctx.rev() in anc: ui.status(_("moving bookmark '%s' forward from %s\n") % (mark, short(bmctx.node()))) diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t index cb95716da5fe37a9bd6a8c7da73dc6caf89d5fe7_dGVzdHMvdGVzdC1ib29rbWFya3MudA==..26c51e87e807d085a24cc9f2321c75faaa0c7ff4_dGVzdHMvdGVzdC1ib29rbWFya3MudA== 100644 --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -590,3 +590,24 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: 0 + +test clearing divergent bookmarks of linear ancestors + + $ hg bookmark Z -r 0 + $ hg bookmark Z@1 -r 1 + $ hg bookmark Z@2 -r 2 + $ hg bookmark Z@3 -r 3 + $ hg book + Z 0:f7b1eb17ad24 + Z@1 1:925d80f479bb + Z@2 2:db815d6d32e6 + * Z@3 3:9ba5f110a0b3 + four 3:9ba5f110a0b3 + should-end-on-two 2:db815d6d32e6 + $ hg bookmark Z + moving bookmark 'Z' forward from f7b1eb17ad24 + $ hg book + * Z 3:9ba5f110a0b3 + Z@1 1:925d80f479bb + four 3:9ba5f110a0b3 + should-end-on-two 2:db815d6d32e6