Patchwork [5,of,5,STABLE,V2] bookmarks: move active bookmark forward upon rebase (issue3813) (BC)

login
register
mail settings
Submitter Sean Farley
Date May 1, 2013, 9:05 p.m.
Message ID <7b2dacd764a45bcb7e6f.1367442302@laptop.local>
Download mbox | patch
Permalink /patch/1530/
State Rejected, archived
Delegated to: Kevin Bullock
Headers show

Comments

Sean Farley - May 1, 2013, 9:05 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1367440183 18000
#      Wed May 01 15:29:43 2013 -0500
# Branch stable
# Node ID 7b2dacd764a45bcb7e6f710f483ea38504b0f2e0
# Parent  1d0fc3f943c59b8cc170d3d6dcd9c7429fc3b6bd
bookmarks: move active bookmark forward upon rebase (issue3813) (BC)

Before this patch, when rebasing another bookmark on top of the active
bookmark, the active bookmark would be deactivated. Now, the active bookmark is
advanced to the tip of the rebase. Test cases have been updated accordingly.
Matt Mackall - May 1, 2013, 10:03 p.m.
On Wed, 2013-05-01 at 16:05 -0500, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1367440183 18000
> #      Wed May 01 15:29:43 2013 -0500
> # Branch stable
> # Node ID 7b2dacd764a45bcb7e6f710f483ea38504b0f2e0
> # Parent  1d0fc3f943c59b8cc170d3d6dcd9c7429fc3b6bd
> bookmarks: move active bookmark forward upon rebase (issue3813) (BC)

I've queued the first four of these. Looks like this one still needs
some discussion.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -335,13 +335,14 @@ 
         ui.note(_("rebase completed\n"))
         util.unlinkpath(repo.sjoin('undo'), ignoremissing=True)
         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)
+        if activebookmark:
+            repo._bookmarks[activebookmark] = repo['tip'].node()
+            bookmarks.setcurrent(repo, activebookmark)
+            repo._bookmarks.write()
 
     finally:
         release(lock, wlock)
 
 def checkexternal(repo, state, targetancestors):
diff --git a/tests/test-rebase-bookmarks.t b/tests/test-rebase-bookmarks.t
--- a/tests/test-rebase-bookmarks.t
+++ b/tests/test-rebase-bookmarks.t
@@ -117,13 +117,13 @@ 
 
   $ hg rebase -d W
   saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
 
   $ hg tglog
-  @  3: 'C' bookmarks: Y Z
+  @  3: 'C' bookmarks: X Y Z
   |
-  o  2: 'B' bookmarks: X
+  o  2: 'B' bookmarks:
   |
   o  1: 'D' bookmarks: W
   |
   o  0: 'A' bookmarks:
   
@@ -146,15 +146,15 @@ 
   $ echo 'c' > c
   $ hg resolve --mark c
   $ hg rebase --continue
   saved backup bundle to $TESTTMP/a3/.hg/strip-backup/3d5fa227f4b5-backup.hg (glob)
   $ hg tglog
-  @  4: 'C' bookmarks: Y Z
+  @  4: 'C' bookmarks: X Y Z
   |
   o  3: 'other C' bookmarks:
   |
-  o  2: 'B' bookmarks: X
+  o  2: 'B' bookmarks:
   |
   o  1: 'D' bookmarks: W
   |
   o  0: 'A' bookmarks: