# HG changeset patch # User Matt Mackall # Date 2014-07-08 19:45:55 # Node ID 92666a869ea4e39d31b836831ef9f7abdf72bc1a # Parent fd2527d9b995879023e256b1a985f2791be1480a 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. diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -164,6 +164,9 @@ def deletedivergent(repo, deletefrom, bm 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]