Mercurial > hg > mercurial-source
changeset 23748:d7324c242c3f
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.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 21 Dec 2014 13:56:32 -0800 |
parents | b9d06fa10ef2 |
children | b56400eeefaf |
files | mercurial/namespaces.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/namespaces.py +++ b/mercurial/namespaces.py @@ -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