Show More
@@ -2623,6 +2623,7 b' class generatorset(abstractsmartset):' | |||||
2623 | self._cache = {} |
|
2623 | self._cache = {} | |
2624 | self._genlist = [] |
|
2624 | self._genlist = [] | |
2625 | self._finished = False |
|
2625 | self._finished = False | |
|
2626 | self._ascending = True | |||
2626 | if iterasc is not None: |
|
2627 | if iterasc is not None: | |
2627 | if iterasc: |
|
2628 | if iterasc: | |
2628 | self.fastasc = self._iterator |
|
2629 | self.fastasc = self._iterator | |
@@ -2679,7 +2680,17 b' class generatorset(abstractsmartset):' | |||||
2679 | return False |
|
2680 | return False | |
2680 |
|
2681 | |||
2681 | def __iter__(self): |
|
2682 | def __iter__(self): | |
2682 | return self._iterator() |
|
2683 | if self._ascending: | |
|
2684 | it = self.fastasc | |||
|
2685 | else: | |||
|
2686 | it = self.fastdesc | |||
|
2687 | if it is not None: | |||
|
2688 | return it() | |||
|
2689 | # we need to consume the iterator | |||
|
2690 | for x in self._consumegen(): | |||
|
2691 | pass | |||
|
2692 | # recall the same code | |||
|
2693 | return iter(self) | |||
2683 |
|
2694 | |||
2684 | def _iterator(self): |
|
2695 | def _iterator(self): | |
2685 | if self._finished: |
|
2696 | if self._finished: | |
@@ -2723,10 +2734,10 b' class generatorset(abstractsmartset):' | |||||
2723 | return self |
|
2734 | return self | |
2724 |
|
2735 | |||
2725 | def sort(self, reverse=False): |
|
2736 | def sort(self, reverse=False): | |
2726 | if not self._finished: |
|
2737 | self._ascending = not reverse | |
2727 | for i in self: |
|
2738 | ||
2728 | continue |
|
2739 | def reverse(self): | |
2729 | self._genlist.sort(reverse=reverse) |
|
2740 | self._ascending = not self._ascending | |
2730 |
|
2741 | |||
2731 | def spanset(repo, start=None, end=None): |
|
2742 | def spanset(repo, start=None, end=None): | |
2732 | """factory function to dispatch between fullreposet and actual spanset |
|
2743 | """factory function to dispatch between fullreposet and actual spanset |
General Comments 0
You need to be logged in to leave comments.
Login now