# HG changeset patch # User Sean Farley # Date 2014-12-21 21:56:32 # Node ID d7324c242c3fd509c7c8dbc8cfca6534ea2251ec # Parent b9d06fa10ef29c012d48bd4f3c93fd7bf1347d40 namespaces: add __getitem__ property Since the namespaces object uses an underlying (sorted) dictionary to store the namespaces, it makes sense to expose this to naturally gain access to those namespaces. diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py --- a/mercurial/namespaces.py +++ b/mercurial/namespaces.py @@ -42,6 +42,10 @@ class namespaces(object): lambda repo, node: [repo[node].branch()]) self.addnamespace(n) + def __getitem__(self, namespace): + """returns the namespace object""" + return self._names[namespace] + def addnamespace(self, namespace, order=None): """register a namespace