Comments
Patch
@@ -718,10 +718,25 @@ class localrepository(object):
def label(self, namespace, name, node):
'''Add a label to self._labels[namespace][name]'''
self._createlabelnamespace(namespace)
self._labels[namespace][name] = node
+ def labels(self, namespace):
+ '''Return a dictionary of labels in the namespace.
+
+ This also allows accessing bookmarks and tags.
+ '''
+ if namespace == "bookmarks":
+ return self._bookmarks
+
+ if namespace == "tags":
+ return self.tags()
+
+ # if the namespace doesn't exist, then we initialize it
+ self._createlabelnamespace(namespace)
+ return self._labels[namespace]
+
def branchmap(self):
'''returns a dictionary {branch: [branchheads]} with branchheads
ordered by increasing revision number'''
branchmap.updatecache(self)
return self._branchcaches[self.filtername]