Mercurial > hg > mercurial-source
changeset 23773:19d6271a70db
namespaces: add __iter__ and iteritems methods
Iterating over all the namespaces is a common operation, naturally, so we add
those methods now. Since we are using a sorted dictionary, this method just
calls the underlying __iter__ or iteritems method.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Mon, 22 Dec 2014 09:07:37 -0800 |
parents | 50229b4c33be |
children | 0390cc327dd5 |
files | mercurial/namespaces.py |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/namespaces.py +++ b/mercurial/namespaces.py @@ -49,6 +49,12 @@ """returns the namespace object""" return self._names[namespace] + def __iter__(self): + return self._names.__iter__() + + def iteritems(self): + return self._names.iteritems() + def addnamespace(self, namespace, order=None): """register a namespace