comparison mercurial/revset.py @ 22797:61ecabeeadb3

generatorset: move iteration code into _iterator _iterator handles the generator iteration. The `__iter__` method will need changes to handle ordering-related information.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 03 Oct 2014 20:48:28 -0700
parents 43f664bf2e1e
children 586d7058ea48
comparison
equal deleted inserted replaced
22796:43f664bf2e1e 22797:61ecabeeadb3
2624 self._cache = {} 2624 self._cache = {}
2625 self._genlist = [] 2625 self._genlist = []
2626 self._finished = False 2626 self._finished = False
2627 if iterasc is not None: 2627 if iterasc is not None:
2628 if iterasc: 2628 if iterasc:
2629 self.fastasc = self.__iter__ 2629 self.fastasc = self._iterator
2630 self.__contains__ = self._asccontains 2630 self.__contains__ = self._asccontains
2631 else: 2631 else:
2632 self.fastdesc = self.__iter__ 2632 self.fastdesc = self._iterator
2633 self.__contains__ = self._desccontains 2633 self.__contains__ = self._desccontains
2634 2634
2635 def __nonzero__(self): 2635 def __nonzero__(self):
2636 for r in self: 2636 for r in self:
2637 return True 2637 return True
2678 2678
2679 self._cache[x] = False 2679 self._cache[x] = False
2680 return False 2680 return False
2681 2681
2682 def __iter__(self): 2682 def __iter__(self):
2683 return self._iterator()
2684
2685 def _iterator(self):
2683 if self._finished: 2686 if self._finished:
2684 return iter(self._genlist) 2687 return iter(self._genlist)
2685 2688
2686 # We have to use this complex iteration strategy to allow multiple 2689 # We have to use this complex iteration strategy to allow multiple
2687 # iterations at the same time. We need to be able to catch revision 2690 # iterations at the same time. We need to be able to catch revision