# HG changeset patch # User Tony Tung # Date 1431664506 25200 # Node ID 91c2278c68a387903c00a7170509c9dd343a7e55 # Parent 8b99e9a8db05d77937a9905cc77e946171159acc rebase: check that the bookmark is still valid when restoring (issue4669) After a rebase --abort, we attempt to restore the previously active bookmark. We need to ensure that the bookmark still exists. diff -r 8b99e9a8db05 -r 91c2278c68a3 hgext/rebase.py --- a/hgext/rebase.py Fri May 15 22:32:31 2015 +0900 +++ b/hgext/rebase.py Thu May 14 21:35:06 2015 -0700 @@ -892,7 +892,7 @@ # no backup of rebased cset versions needed repair.strip(repo.ui, repo, strippoints) - if activebookmark: + if activebookmark and activebookmark in repo._bookmarks: bookmarks.setcurrent(repo, activebookmark) clearstatus(repo) diff -r 8b99e9a8db05 -r 91c2278c68a3 tests/test-bookmarks-rebase.t --- a/tests/test-bookmarks-rebase.t Fri May 15 22:32:31 2015 +0900 +++ b/tests/test-bookmarks-rebase.t Thu May 14 21:35:06 2015 -0700 @@ -90,3 +90,18 @@ * three 4:dd7c838e8362 two 3:42e5ed2cdcf4 +after aborted rebase, restoring a bookmark that has been removed should not fail + + $ hg rebase -s three -d two + rebasing 4:dd7c838e8362 "4" (tip three) + merging d + warning: conflicts during merge. + merging d incomplete! (edit conflicts, then use 'hg resolve --mark') + unresolved conflicts (see hg resolve, then hg rebase --continue) + [1] + $ hg bookmark -d three + $ hg rebase --abort + rebase aborted + $ hg bookmark + one 1:925d80f479bb + two 3:42e5ed2cdcf4