generatorset: move iteration code into _iterator
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 03 Oct 2014 20:48:28 -0700
changeset 22797 61ecabeeadb3
parent 22796 43f664bf2e1e
child 22798 586d7058ea48
generatorset: move iteration code into _iterator _iterator handles the generator iteration. The `__iter__` method will need changes to handle ordering-related information.
mercurial/revset.py
--- a/mercurial/revset.py	Fri Oct 03 20:43:48 2014 -0700
+++ b/mercurial/revset.py	Fri Oct 03 20:48:28 2014 -0700
@@ -2626,10 +2626,10 @@
         self._finished = False
         if iterasc is not None:
             if iterasc:
-                self.fastasc = self.__iter__
+                self.fastasc = self._iterator
                 self.__contains__ = self._asccontains
             else:
-                self.fastdesc = self.__iter__
+                self.fastdesc = self._iterator
                 self.__contains__ = self._desccontains
 
     def __nonzero__(self):
@@ -2680,6 +2680,9 @@
         return False
 
     def __iter__(self):
+        return self._iterator()
+
+    def _iterator(self):
         if self._finished:
             return iter(self._genlist)