[PATCH 05 of 12] localrepo: add a method to return all labels for all namespaces

Sean Farley sean.michael.farley at gmail.com
Mon Aug 18 16:18:01 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1396218396 18000
#      Sun Mar 30 17:26:36 2014 -0500
# Node ID c3f7c84a9f217365800b5d942c875ee54f33c7ae
# Parent  0caba51170dc885e485d1e159aabfc8d2e17efda
localrepo: add a method to return all labels for all namespaces

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -733,10 +733,21 @@ class localrepository(object):
 
         # if the namespace doesn't exist, then we initialize it
         self._createlabelnamespace(namespace)
         return self._labels[namespace]
 
+    def alllabels(self):
+        '''Return a dictionary of dictionaries of all labels.
+
+        This is a read-only copy and also includes bookmarks and tags.
+        '''
+        l = self._labels.copy()
+        l["tag"] = self.tags()
+        l["bookmark"] = self._bookmarks
+        return l
+
+
     def branchmap(self):
         '''returns a dictionary {branch: [branchheads]} with branchheads
         ordered by increasing revision number'''
         branchmap.updatecache(self)
         return self._branchcaches[self.filtername]


More information about the Mercurial-devel mailing list