Show More
@@ -2767,6 +2767,34 b' class generatorset(abstractsmartset):' | |||||
2767 | def isdescending(self): |
|
2767 | def isdescending(self): | |
2768 | return not self._ascending |
|
2768 | return not self._ascending | |
2769 |
|
2769 | |||
|
2770 | def first(self): | |||
|
2771 | if self._ascending: | |||
|
2772 | it = self.fastasc | |||
|
2773 | else: | |||
|
2774 | it = self.fastdesc | |||
|
2775 | if it is None: | |||
|
2776 | # we need to consume all and try again | |||
|
2777 | for x in self._consumegen(): | |||
|
2778 | pass | |||
|
2779 | return self.first() | |||
|
2780 | if self: | |||
|
2781 | return it.next() | |||
|
2782 | return None | |||
|
2783 | ||||
|
2784 | def last(self): | |||
|
2785 | if self._ascending: | |||
|
2786 | it = self.fastdesc | |||
|
2787 | else: | |||
|
2788 | it = self.fastasc | |||
|
2789 | if it is None: | |||
|
2790 | # we need to consume all and try again | |||
|
2791 | for x in self._consumegen(): | |||
|
2792 | pass | |||
|
2793 | return self.first() | |||
|
2794 | if self: | |||
|
2795 | return it.next() | |||
|
2796 | return None | |||
|
2797 | ||||
2770 | def spanset(repo, start=None, end=None): |
|
2798 | def spanset(repo, start=None, end=None): | |
2771 | """factory function to dispatch between fullreposet and actual spanset |
|
2799 | """factory function to dispatch between fullreposet and actual spanset | |
2772 |
|
2800 |
General Comments 0
You need to be logged in to leave comments.
Login now