Patchwork [2,of,2] rebase: verify that the bookmark is still valid when attempting to restore

login
register
mail settings
Submitter Tony Tung
Date May 15, 2015, 4:38 a.m.
Message ID <c7914726fe5104221c42.1431664681@andromeda.local>
Download mbox | patch
Permalink /patch/9083/
State Accepted
Headers show

Comments

Tony Tung - May 15, 2015, 4:38 a.m.
# HG changeset patch
# User Tony Tung <tonytung@fb.com>
# Date 1431664506 25200
#      Thu May 14 21:35:06 2015 -0700
# Node ID c7914726fe5104221c422cc426a9c2a6eadf6499
# Parent  51ff6de941359602277646e04573360962328c24
rebase: verify that the bookmark is still valid when attempting to restore

After a rebase --abort, we attempt to restore the previously active
bookmark.  We need to ensure that the bookmark still exists.

This resolves http://bz.selenic.com/show_bug.cgi?id=4669
Pierre-Yves David - May 15, 2015, 7:51 a.m.
On 05/14/2015 09:38 PM, Tony Tung wrote:
> # HG changeset patch
> # User Tony Tung <tonytung@fb.com>
> # Date 1431664506 25200
> #      Thu May 14 21:35:06 2015 -0700
> # Node ID c7914726fe5104221c422cc426a9c2a6eadf6499
> # Parent  51ff6de941359602277646e04573360962328c24
> rebase: verify that the bookmark is still valid when attempting to restore

I've pushed these two on the clowncopter. thanks

I've put the second one the stable branch (and included the issue number)

I also had to fix the commit messages for the first one 
(test-check-commit-hg.t complained, did you ran the tests?)

the setcurrent will have to be rename activate when merging with 
default. (CCing Matt as he will do the merge)

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -890,8 +890,8 @@ 
             # no backup of rebased cset versions needed
             repair.strip(repo.ui, repo, strippoints)
 
-    if activebookmark:
-        bookmarks.activate(repo, activebookmark)
+    if activebookmark and activebookmark in repo._bookmarks:
+        bookmarks.setcurrent(repo, activebookmark)
 
     clearstatus(repo)
     repo.ui.warn(_('rebase aborted\n'))
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 @@ 
    * 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