From patchwork Wed Dec 17 00:01:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4, of, 7] namespaces: add names method to return list of names for a given node From: Sean Farley X-Patchwork-Id: 7132 Message-Id: <540c8c40fd3cd46b2609.1418774518@laptop.local> To: mercurial-devel@selenic.com Date: Tue, 16 Dec 2014 16:01:58 -0800 # HG changeset patch # User Sean Farley # 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))