Comments
Patch
@@ -2180,6 +2180,50 @@
def set(self):
return self
+class ascgeneratorset(generatorset):
+ def __contains__(self, x):
+ if x in self._pcache:
+ return True
+ if x in self._ncache:
+ return False
+
+ while True:
+ try:
+ l = self._iter.next()
+ self._pcache.add(l)
+ if l == x:
+ return True
+ if l > x:
+ self._ncache.add(x)
+ return False
+ except (StopIteration):
+ break
+
+ self._ncache.add(x)
+ return False
+
+class descgeneratorset(generatorset):
+ def __contains__(self, x):
+ if x in self._pcache:
+ return True
+ if x in self._ncache:
+ return False
+
+ while True:
+ try:
+ l = self._iter.next()
+ self._pcache.add(l)
+ if l == x:
+ return True
+ if l < x:
+ self._ncache.add(x)
+ return False
+ except (StopIteration):
+ break
+
+ self._ncache.add(x)
+ return False
+
class spanset(object):
"""Duck type for baseset class which represents a range of revisions and
can work lazily and without having all the range in memory