changeset 20523:f2a0a0e76b4c stable

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'".
author Yuya Nishihara <yuya@tcha.org>
date Sat, 15 Feb 2014 16:19:19 +0900
parents 4e41b2fe46cc
children ca970d6acedb
files hgext/rebase.py tests/test-rebase-bookmarks.t
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Thu Feb 13 13:05:09 2014 +0100
+++ b/hgext/rebase.py	Sat Feb 15 16:19:19 2014 +0900
@@ -404,6 +404,9 @@
 
         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"))
--- a/tests/test-rebase-bookmarks.t	Thu Feb 13 13:05:09 2014 +0100
+++ b/tests/test-rebase-bookmarks.t	Sat Feb 15 16:19:19 2014 +0900
@@ -85,6 +85,24 @@
   |/
   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 ..