Patchwork [STABLE] rebase: do not try to reactivate deleted divergent bookmark

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 15, 2014, 7:57 a.m.
Message ID <f2a0a0e76b4cff445c50.1392451073@gimlet>
Download mbox | patch
Permalink /patch/3665/
State Accepted
Commit f2a0a0e76b4cff445c504db68f04582843cd1c72
Headers show

Comments

Yuya Nishihara - Feb. 15, 2014, 7:57 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1392448759 -32400
#      Sat Feb 15 16:19:19 2014 +0900
# Branch stable
# Node ID f2a0a0e76b4cff445c504db68f04582843cd1c72
# Parent  4e41b2fe46ccfb9722e51e23902f7019d286b15d
rebase: do not try to reactivate deleted divergent bookmark

If the currently active bookmark is divergent one, it may be resolved during
rebase.  Trying to activate it will raise "KeyError: 'W@diverge'".
Matt Mackall - Feb. 16, 2014, 4:16 a.m.
On Sat, 2014-02-15 at 16:57 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1392448759 -32400
> #      Sat Feb 15 16:19:19 2014 +0900
> # Branch stable
> # Node ID f2a0a0e76b4cff445c504db68f04582843cd1c72
> # Parent  4e41b2fe46ccfb9722e51e23902f7019d286b15d
> rebase: do not try to reactivate deleted divergent bookmark

Queued for default, thanks.
Yuya Nishihara - Feb. 16, 2014, 5:11 p.m.
On Sat, 15 Feb 2014 22:16:11 -0600, Matt Mackall wrote:
> On Sat, 2014-02-15 at 16:57 +0900, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya@tcha.org>
> > # Date 1392448759 -32400
> > #      Sat Feb 15 16:19:19 2014 +0900
> > # Branch stable
> > # Node ID f2a0a0e76b4cff445c504db68f04582843cd1c72
> > # Parent  4e41b2fe46ccfb9722e51e23902f7019d286b15d
> > rebase: do not try to reactivate deleted divergent bookmark
> 
> Queued for default, thanks.

Typo of "stable" ?

This patch fixes KeyError occurred when active bookmark is deleted during
rebase.

Regards,

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -404,6 +404,9 @@  def rebase(ui, repo, **opts):
 
         if currentbookmarks:
             updatebookmarks(repo, targetnode, nstate, currentbookmarks)
+            if activebookmark not in repo._bookmarks:
+                # active bookmark was divergent one and has been deleted
+                activebookmark = None
 
         clearstatus(repo)
         ui.note(_("rebase completed\n"))
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
@@ -85,6 +85,24 @@  Test deleting divergent bookmarks from d
   |/
   o  0: 'A' bookmarks: Y@diverge
   
+Do not try to keep active but deleted divergent bookmark
+
+  $ cd ..
+  $ hg clone -q a a4
+
+  $ cd a4
+  $ hg up -q 2
+  $ hg book W@diverge
+
+  $ hg rebase -s W -d .
+  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/*-backup.hg (glob)
+
+  $ hg bookmarks
+     W                         3:0d3554f74897
+     X                         1:6c81ed0049f8
+     Y                         2:49cb3485fa0c
+     Z                         2:49cb3485fa0c
+
 Keep bookmarks to the correct rebased changeset
 
   $ cd ..