Mercurial > hg
comparison mercurial/bookmarks.py @ 21843:92666a869ea4 stable
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.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 08 Jul 2014 14:45:55 -0500 |
parents | 58300f61b139 |
children | 5c153c69fdb2 |
comparison
equal
deleted
inserted
replaced
21842:fd2527d9b995 | 21843:92666a869ea4 |
---|---|
162 Return True if at least one bookmark was deleted, False otherwise.''' | 162 Return True if at least one bookmark was deleted, False otherwise.''' |
163 deleted = False | 163 deleted = False |
164 marks = repo._bookmarks | 164 marks = repo._bookmarks |
165 divergent = [b for b in marks if b.split('@', 1)[0] == bm.split('@', 1)[0]] | 165 divergent = [b for b in marks if b.split('@', 1)[0] == bm.split('@', 1)[0]] |
166 for mark in divergent: | 166 for mark in divergent: |
167 if mark == '@' or '@' not in mark: | |
168 # can't be divergent by definition | |
169 continue | |
167 if mark and marks[mark] in deletefrom: | 170 if mark and marks[mark] in deletefrom: |
168 if mark != bm: | 171 if mark != bm: |
169 del marks[mark] | 172 del marks[mark] |
170 deleted = True | 173 deleted = True |
171 return deleted | 174 return deleted |