revset: added documentation and comment for spanset class
authorLucas Moscovicz <lmoscovicz@fb.com>
Fri, 14 Mar 2014 10:59:51 -0700
changeset 20737 b141080e70c5
parent 20736 b0203624ab20
child 20738 33943add5d65
revset: added documentation and comment for spanset class
mercurial/revset.py
--- a/mercurial/revset.py	Tue Mar 11 17:25:53 2014 -0700
+++ b/mercurial/revset.py	Fri Mar 14 10:59:51 2014 -0700
@@ -2640,8 +2640,22 @@
 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
+
+    Note that spanset(x, y) behave almost like xrange(x, y) except for two
+    notable points:
+    - when x < y it will be automatically descending,
+    - revision filtered with this repoview will be skipped.
+
     """
     def __init__(self, repo, start=0, end=None):
+        """
+        start: first revision included the set
+               (default to 0)
+        end:   first revision excluded (last+1)
+               (default to len(repo)
+
+        Spanset will be descending if `end` < `start`.
+        """
         self._start = start
         if end is not None:
             self._end = end
@@ -2729,6 +2743,7 @@
             self.reverse()
 
     def reverse(self):
+        # Just switch the _start and _end parameters
         if self._start <= self._end:
             self._start, self._end = self._end - 1, self._start - 1
         else: