[PATCH 4 of 7 V2] namespaces: add names method to return list of names for a given node

Sean Farley sean.michael.farley at gmail.com
Thu Dec 18 15:10:48 CST 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1418612090 28800
#      Sun Dec 14 18:54:50 2014 -0800
# Node ID a6308360a56c275faf1fe8807babd48a37c0d012
# Parent  430e5b84bcf084090939993ab9a05f342bbb85ed
namespaces: add names method to return list of names for a given node

In the previous patch, we added a node-to-name map property. This patch just
exposes that interface to the api.

diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -94,5 +94,10 @@ class namespaces(object):
         raise KeyError(_('no such name: %s') % name)
 
     def templatename(self, namespace):
         """method that returns the template name of a namespace"""
         return self._names[namespace]['templatename']
+
+    def names(self, repo, namespace, node):
+        """method that returns a (sorted) list of names in a namespace that
+        match a given node"""
+        return sorted(self._names[namespace]['nodemap'](repo, node))


More information about the Mercurial-devel mailing list