diff hgext/rebase.py @ 24758:d7451adc72f6

rebase: restore bookmark state on abort The bookmark state was already being preserved, but it wasn't being properly restored.
author Tony Tung <tonytung@fb.com>
date Mon, 13 Apr 2015 14:54:02 -0400
parents 8a544fb645bb
children 4ec40a4db64a
line wrap: on
line diff
--- a/hgext/rebase.py	Sat Apr 04 02:37:43 2015 -0700
+++ b/hgext/rebase.py	Mon Apr 13 14:54:02 2015 -0400
@@ -231,7 +231,8 @@
                     hint = _('use "hg rebase --abort" to clear broken state')
                     raise util.Abort(msg, hint=hint)
             if abortf:
-                return abort(repo, originalwd, target, state)
+                return abort(repo, originalwd, target, state,
+                             activebookmark=activebookmark)
         else:
             if srcf and basef:
                 raise util.Abort(_('cannot specify both a '
@@ -852,8 +853,11 @@
 
     return False
 
-def abort(repo, originalwd, target, state):
-    'Restore the repository to its original state'
+def abort(repo, originalwd, target, state, activebookmark=None):
+    '''Restore the repository to its original state.  Additional args:
+
+    activebookmark: the name of the bookmark that should be active after the
+        restore'''
     dstates = [s for s in state.values() if s >= 0]
     immutable = [d for d in dstates if not repo[d].mutable()]
     cleanup = True
@@ -883,6 +887,9 @@
             # no backup of rebased cset versions needed
             repair.strip(repo.ui, repo, strippoints)
 
+    if activebookmark:
+        bookmarks.setcurrent(repo, activebookmark)
+
     clearstatus(repo)
     repo.ui.warn(_('rebase aborted\n'))
     return 0