bookmarks: avoid deleting primary bookmarks on rebase stable
authorMatt Mackall <mpm@selenic.com>
Tue, 08 Jul 2014 14:45:55 -0500
branchstable
changeset 21843 92666a869ea4
parent 21842 fd2527d9b995
child 21850 3b97a93dc137
child 21855 1eda3e556845
bookmarks: avoid deleting primary bookmarks on rebase Prior to this, doing "hg rebase -s @foo -d @" would delete @, which is obviously wrong: a primary bookmark should never be automatically deleted. This change blocks the deletion, but doesn't yet properly clean up the divergence: @ should replace @foo.
mercurial/bookmarks.py
--- a/mercurial/bookmarks.py	Thu Jul 03 10:56:03 2014 +0100
+++ b/mercurial/bookmarks.py	Tue Jul 08 14:45:55 2014 -0500
@@ -164,6 +164,9 @@
     marks = repo._bookmarks
     divergent = [b for b in marks if b.split('@', 1)[0] == bm.split('@', 1)[0]]
     for mark in divergent:
+        if mark == '@' or '@' not in mark:
+            # can't be divergent by definition
+            continue
         if mark and marks[mark] in deletefrom:
             if mark != bm:
                 del marks[mark]