[PATCH 2 of 6] context: add method to return all bookmarks pointing to a node
David Soria Parra
dsp at php.net
Fri Feb 11 13:37:26 CST 2011
# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1297449375 -3600
# Node ID 838d81f98a7d1ffc24955e9c7e14976c0dd6ba7d
# Parent 6e548aa298cf04b0ad054a0e4a3ba6a0cf24795f
context: add method to return all bookmarks pointing to a node
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -114,6 +114,8 @@
return self._changeset[5]
def tags(self):
return self._repo.nodetags(self._node)
+ def bookmarks(self):
+ return self._repo.nodebookmarks(self._node)
def parents(self):
"""return contexts for each parent changeset"""
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -399,6 +399,13 @@
tags.sort()
return self.nodetagscache.get(node, [])
+ def nodebookmarks(self, node):
+ marks = []
+ for bookmark, n in self._bookmarks.iteritems():
+ if n == node:
+ marks.append(bookmark)
+ return sorted(marks)
+
def _branchtags(self, partial, lrev):
# TODO: rename this function?
tiprev = len(self) - 1
More information about the Mercurial-devel
mailing list