equal
deleted
inserted
replaced
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 import os |
8 import os |
9 from mercurial.i18n import _ |
9 from mercurial.i18n import _ |
10 from mercurial.node import hex, bin |
10 from mercurial.node import hex, bin |
11 from mercurial import encoding, error, util, obsolete, lock as lockmod |
11 from mercurial import encoding, util, obsolete, lock as lockmod |
12 import errno |
12 import errno |
13 |
13 |
14 class bmstore(dict): |
14 class bmstore(dict): |
15 """Storage for bookmarks. |
15 """Storage for bookmarks. |
16 |
16 |
175 mark = repo._activebookmark |
175 mark = repo._activebookmark |
176 if not parents: |
176 if not parents: |
177 parents = [p.node() for p in repo[None].parents()] |
177 parents = [p.node() for p in repo[None].parents()] |
178 marks = repo._bookmarks |
178 marks = repo._bookmarks |
179 return (mark in marks and marks[mark] in parents) |
179 return (mark in marks and marks[mark] in parents) |
180 |
|
181 def updatecurrentbookmark(repo, oldnode, curbranch): |
|
182 try: |
|
183 return update(repo, oldnode, repo.branchtip(curbranch)) |
|
184 except error.RepoLookupError: |
|
185 if curbranch == "default": # no default branch! |
|
186 return update(repo, oldnode, repo.lookup("tip")) |
|
187 else: |
|
188 raise util.Abort(_("branch %s not found") % curbranch) |
|
189 |
180 |
190 def deletedivergent(repo, deletefrom, bm): |
181 def deletedivergent(repo, deletefrom, bm): |
191 '''Delete divergent versions of bm on nodes in deletefrom. |
182 '''Delete divergent versions of bm on nodes in deletefrom. |
192 |
183 |
193 Return True if at least one bookmark was deleted, False otherwise.''' |
184 Return True if at least one bookmark was deleted, False otherwise.''' |