[PATCH 4 of 5] namespaces: add method to return a list of nodes for a given name

Sean Farley sean.michael.farley at gmail.com
Wed Jan 7 18:15:55 CST 2015


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1418683564 28800
#      Mon Dec 15 14:46:04 2014 -0800
# Node ID b4996d3d9ed2de964a9507b66932084f86bbbc76
# Parent  267ff85247daf9784461688616301315d82a2792
namespaces: add method to return a list of nodes for a given name

This is a helpful method that some extensions can make use of (e.g. for custom
revsets); currently not used in core.

diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -138,5 +138,12 @@ class namespace(object):
 
     def names(self, repo, node):
         """method that returns a (sorted) list of names in a namespace that
         match a given node"""
         return sorted(self.nodemap(repo, node))
+
+    def nodes(self, repo, name):
+        """method that returns a list of nodes in a namespace that
+        match a given name.
+
+        """
+        return sorted(self.namemap(repo, name))


More information about the Mercurial-devel mailing list