[PATCH 1 of 2 v3] localrepo: introduce bookmarkheads

David Soria Parra dsp at php.net
Sun May 13 04:57:55 CDT 2012


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1336902898 -7200
# Node ID f92201802b3c44c4ab37bd5ecbe6e35749fe94be
# Parent  21422ce4ccca39c16d6aeb99d6cb372e780d8732
localrepo: introduce bookmarkheads

Similar to branch heads we introduce the notion of bookmarkheads.
Bookmarkheads are changests that are bookmarked with the given bookmark
or a diverged version

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -180,6 +180,14 @@
     def _writebookmarks(self, marks):
       bookmarks.write(self)
 
+    def bookmarkheads(self, bookmark):
+        name = bookmark.split('@', 1)[0]
+        heads = []
+        for mark, n in self._bookmarks.iteritems():
+            if mark.split('@', 1)[0] == name:
+                heads.append(n)
+        return heads
+
     @storecache('phaseroots')
     def _phasecache(self):
         return phases.phasecache(self, self._phasedefaults)


More information about the Mercurial-devel mailing list