hgext/rebase.py
changeset 17059 fba17a64fa49
parent 17028 efd2e14f7235
parent 17046 4116504d1ec4
child 17325 e4db509c08ec
--- a/hgext/rebase.py	Fri Jun 29 00:01:19 2012 +0200
+++ b/hgext/rebase.py	Fri Jun 29 00:40:52 2012 -0500
@@ -238,6 +238,9 @@
 
         # Keep track of the current bookmarks in order to reset them later
         currentbookmarks = repo._bookmarks.copy()
+        activebookmark = repo._bookmarkcurrent
+        if activebookmark:
+            bookmarks.unsetcurrent(repo)
 
         sortedstate = sorted(state)
         total = len(sortedstate)
@@ -327,6 +330,11 @@
             util.unlinkpath(repo.sjoin('undo'))
         if skipped:
             ui.note(_("%d revisions have been skipped\n") % len(skipped))
+
+        if (activebookmark and
+            repo['tip'].node() == repo._bookmarks[activebookmark]):
+                bookmarks.setcurrent(repo, activebookmark)
+
     finally:
         release(lock, wlock)
 
@@ -476,13 +484,11 @@
 
 def updatebookmarks(repo, nstate, originalbookmarks, **opts):
     'Move bookmarks to their correct changesets'
-    current = repo._bookmarkcurrent
     for k, v in originalbookmarks.iteritems():
         if v in nstate:
             if nstate[v] != nullmerge:
-                # reset the pointer if the bookmark was moved incorrectly
-                if k != current:
-                    repo._bookmarks[k] = nstate[v]
+                # update the bookmarks for revs that have moved
+                repo._bookmarks[k] = nstate[v]
 
     bookmarks.write(repo)