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

login
register
mail settings
Submitter Sean Farley
Date Dec. 17, 2014, 12:01 a.m.
Message ID <540c8c40fd3cd46b2609.1418774518@laptop.local>
Download mbox | patch
Permalink /patch/7132/
State Superseded
Commit 807ee1a02bb0ab582407f5691d5790d84dd7c056
Headers show

Comments

Sean Farley - Dec. 17, 2014, 12:01 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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

Patch

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))