##// END OF EJS Templates
revset: added documentation and comment for spanset class
Lucas Moscovicz -
r20737:b141080e default
parent child Browse files
Show More
@@ -2640,8 +2640,22 b' class _descgeneratorset(_generatorset):'
2640 class spanset(object):
2640 class spanset(object):
2641 """Duck type for baseset class which represents a range of revisions and
2641 """Duck type for baseset class which represents a range of revisions and
2642 can work lazily and without having all the range in memory
2642 can work lazily and without having all the range in memory
2643
2644 Note that spanset(x, y) behave almost like xrange(x, y) except for two
2645 notable points:
2646 - when x < y it will be automatically descending,
2647 - revision filtered with this repoview will be skipped.
2648
2643 """
2649 """
2644 def __init__(self, repo, start=0, end=None):
2650 def __init__(self, repo, start=0, end=None):
2651 """
2652 start: first revision included the set
2653 (default to 0)
2654 end: first revision excluded (last+1)
2655 (default to len(repo)
2656
2657 Spanset will be descending if `end` < `start`.
2658 """
2645 self._start = start
2659 self._start = start
2646 if end is not None:
2660 if end is not None:
2647 self._end = end
2661 self._end = end
@@ -2729,6 +2743,7 b' class spanset(object):'
2729 self.reverse()
2743 self.reverse()
2730
2744
2731 def reverse(self):
2745 def reverse(self):
2746 # Just switch the _start and _end parameters
2732 if self._start <= self._end:
2747 if self._start <= self._end:
2733 self._start, self._end = self._end - 1, self._start - 1
2748 self._start, self._end = self._end - 1, self._start - 1
2734 else:
2749 else:
General Comments 0
You need to be logged in to leave comments. Login now