diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -890,7 +890,7 @@ def abort(repo, originalwd, target, stat # no backup of rebased cset versions needed repair.strip(repo.ui, repo, strippoints) - if activebookmark: + if activebookmark and activebookmark in repo._bookmarks: bookmarks.activate(repo, activebookmark) clearstatus(repo) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2095,7 +2095,6 @@ methods = { "parent": parentspec, "parentpost": p1, "only": only, - "onlypost": only, } def optimize(x, small): @@ -2112,6 +2111,8 @@ def optimize(x, small): elif op == 'only': return optimize(('func', ('symbol', 'only'), ('list', x[1], x[2])), small) + elif op == 'onlypost': + return optimize(('func', ('symbol', 'only'), x[1]), small) elif op == 'dagrangepre': return optimize(('func', ('symbol', 'ancestors'), x[1]), small) elif op == 'dagrangepost': diff --git a/tests/test-bookmarks-rebase.t b/tests/test-bookmarks-rebase.t --- a/tests/test-bookmarks-rebase.t +++ b/tests/test-bookmarks-rebase.t @@ -90,3 +90,18 @@ aborted rebase should restore active boo * 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 diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -593,6 +593,29 @@ Test '%' operator 8 9 +Test opreand of '%' is optimized recursively (issue4670) + + $ try --optimize '8:9-8%' + (onlypost + (minus + (range + ('symbol', '8') + ('symbol', '9')) + ('symbol', '8'))) + * optimized: + (func + ('symbol', 'only') + (and + (range + ('symbol', '8') + ('symbol', '9')) + (not + ('symbol', '8')))) + * set: + + 8 + 9 + Test the order of operations $ log '7 + 9%5 + 2'