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

login
register
mail settings
Submitter Sean Farley
Date Aug. 18, 2014, 9:18 p.m.
Message ID <c3f7c84a9f217365800b.1408396681@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/5463/
State Changes Requested
Headers show

Comments

Sean Farley - Aug. 18, 2014, 9:18 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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

Patch

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]