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

Sean Farley sean.michael.farley at gmail.com
Tue Dec 16 18:01:58 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 540c8c40fd3cd46b26092acd1d88cb4525b3e9ef
# Parent  3edda131b6c2e4c40f4f0d75391bccccdc3d2e62
namespaces: add names method to return list of names for a given node

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 singular(self, namespace):
         """method that returns the singular version of a namespace"""
         return self._names[namespace]['singular']
+
+    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