[PATCH 2 of 8] namespaces: add a method to register new namespaces

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Dec 14 19:06:03 CST 2014



On 12/14/2014 04:37 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1413570351 25200
> #      Fri Oct 17 11:25:51 2014 -0700
> # Node ID 98bc28635ee1999c778e5c98f55423147d316a9e
> # Parent  eb7489c4b2f83efcfbeca4c3b68022bd5596e352
> namespaces: add a method to register new namespaces
>
> diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
> --- a/mercurial/namespaces.py
> +++ b/mercurial/namespaces.py
> @@ -32,5 +32,29 @@ class namespaces(object):
>
>       _names_version = 0
>
>       def __init__(self):
>           self._names = util.sortdict()
> +
> +    def addnamespace(self, namespace, singular, names, namemap, nodemap,
> +                     order=None):
> +        """
> +        register a namespace
> +
> +        namespace: the name to be registered (in plural form)
> +        singular: the singular naming of namespace (for output, e.g. log,
> +                  templating, etc.)
> +        names: function to list all names
> +        namemap: function that inputs a node, output name(s)
> +        nodemap: function that inputs a name, output node(s)
> +        order: optional argument to specify the order of namespaces
> +               (e.g. 'branches' should be listed before 'bookmarks')
> +
> +        """

We should probably drop all the extra stuff not used in the first 
series. (singular, nodemap) and reintroduce them when we actually adds 
the feature making use of them.

The surviving data are: namespace and namemap


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list