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.
--- 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