changeset 20737:b141080e70c5

revset: added documentation and comment for spanset class
author Lucas Moscovicz <lmoscovicz@fb.com>
date Fri, 14 Mar 2014 10:59:51 -0700
parents b0203624ab20
children 33943add5d65
files mercurial/revset.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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: