# HG changeset patch # User Sean Farley # Date 1419198992 28800 # 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 -r b9d06fa10ef2 -r d7324c242c3f mercurial/namespaces.py --- a/mercurial/namespaces.py Tue Jan 06 18:18:28 2015 -0600 +++ b/mercurial/namespaces.py Sun Dec 21 13:56:32 2014 -0800 @@ -42,6 +42,10 @@ 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