##// END OF EJS Templates
localrepo: extract bookmarkheads method to bookmarks.py...
Augie Fackler -
r32381:b9942bc6 default
parent child Browse files
Show More
@@ -226,6 +226,28 b' def deletedivergent(repo, deletefrom, bm'
226 deleted = True
226 deleted = True
227 return deleted
227 return deleted
228
228
229 def headsforactive(repo):
230 """Given a repo with an active bookmark, return divergent bookmark nodes.
231
232 Args:
233 repo: A repository with an active bookmark.
234
235 Returns:
236 A list of binary node ids that is the full list of other
237 revisions with bookmarks divergent from the active bookmark. If
238 there were no divergent bookmarks, then this list will contain
239 only one entry.
240 """
241 if not repo._activebookmark:
242 raise ValueError(
243 'headsforactive() only makes sense with an active bookmark')
244 name = repo._activebookmark.split('@', 1)[0]
245 heads = []
246 for mark, n in repo._bookmarks.iteritems():
247 if mark.split('@', 1)[0] == name:
248 heads.append(n)
249 return heads
250
229 def calculateupdate(ui, repo, checkout):
251 def calculateupdate(ui, repo, checkout):
230 '''Return a tuple (targetrev, movemarkfrom) indicating the rev to
252 '''Return a tuple (targetrev, movemarkfrom) indicating the rev to
231 check out and where to move the active bookmark from, if needed.'''
253 check out and where to move the active bookmark from, if needed.'''
@@ -234,7 +234,7 b' msgdestmerge = {'
234 def _destmergebook(repo, action='merge', sourceset=None, destspace=None):
234 def _destmergebook(repo, action='merge', sourceset=None, destspace=None):
235 """find merge destination in the active bookmark case"""
235 """find merge destination in the active bookmark case"""
236 node = None
236 node = None
237 bmheads = repo.bookmarkheads(repo._activebookmark)
237 bmheads = bookmarks.headsforactive(repo)
238 curhead = repo[repo._activebookmark].node()
238 curhead = repo[repo._activebookmark].node()
239 if len(bmheads) == 2:
239 if len(bmheads) == 2:
240 if curhead == bmheads[0]:
240 if curhead == bmheads[0]:
@@ -355,7 +355,7 b' def desthistedit(ui, repo):'
355 return None
355 return None
356
356
357 def _statusotherbook(ui, repo):
357 def _statusotherbook(ui, repo):
358 bmheads = repo.bookmarkheads(repo._activebookmark)
358 bmheads = bookmarks.headsforactive(repo)
359 curhead = repo[repo._activebookmark].node()
359 curhead = repo[repo._activebookmark].node()
360 if repo.revs('%n and parents()', curhead):
360 if repo.revs('%n and parents()', curhead):
361 # we are on the active bookmark
361 # we are on the active bookmark
@@ -507,14 +507,6 b' class localrepository(object):'
507 def _activebookmark(self):
507 def _activebookmark(self):
508 return self._bookmarks.active
508 return self._bookmarks.active
509
509
510 def bookmarkheads(self, bookmark):
511 name = bookmark.split('@', 1)[0]
512 heads = []
513 for mark, n in self._bookmarks.iteritems():
514 if mark.split('@', 1)[0] == name:
515 heads.append(n)
516 return heads
517
518 # _phaserevs and _phasesets depend on changelog. what we need is to
510 # _phaserevs and _phasesets depend on changelog. what we need is to
519 # call _phasecache.invalidate() if '00changelog.i' was changed, but it
511 # call _phasecache.invalidate() if '00changelog.i' was changed, but it
520 # can't be easily expressed in filecache mechanism.
512 # can't be easily expressed in filecache mechanism.
General Comments 0
You need to be logged in to leave comments. Login now