Mercurial > hg-stable
diff mercurial/namespaces.py @ 23761: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 | b9537ee87961 |
line wrap: on
line diff
--- a/mercurial/namespaces.py Mon Dec 15 14:09:00 2014 -0800 +++ b/mercurial/namespaces.py Mon Dec 22 09:07:37 2014 -0800 @@ -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