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

login
register
mail settings
Submitter Sean Farley
Date Jan. 8, 2015, 12:15 a.m.
Message ID <b4996d3d9ed2de964a95.1420676155@laptop.local>
Download mbox | patch
Permalink /patch/7371/
State Accepted
Headers show

Comments

Sean Farley - Jan. 8, 2015, 12:15 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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.

Patch

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