namespaces: add __iter__ and iteritems methods
authorSean Farley <sean.michael.farley@gmail.com>
Mon, 22 Dec 2014 09:07:37 -0800
changeset 23761 19d6271a70db
parent 23760 50229b4c33be
child 23762 0390cc327dd5
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.
mercurial/namespaces.py
--- 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