lazyset: split the iteration logic from the condition filtering logic
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 02 Oct 2014 18:25:37 -0500
changeset 22719 21fda9dcd4e8
parent 22718 7b123e5639f4
child 22720 4388f99c5512
lazyset: split the iteration logic from the condition filtering logic So that the filter can be reused by `fastasc` or `fastdesc`.
mercurial/revset.py
--- a/mercurial/revset.py	Thu Oct 02 17:53:55 2014 -0500
+++ b/mercurial/revset.py	Thu Oct 02 18:25:37 2014 -0500
@@ -2436,8 +2436,11 @@
         return c[x]
 
     def __iter__(self):
+        return self._iterfilter(self._subset)
+
+    def _iterfilter(self, it):
         cond = self._condition
-        for x in self._subset:
+        for x in it:
             if cond(x):
                 yield x