##// END OF EJS Templates
revset: added spanset class to represent revision ranges
Lucas Moscovicz -
r20482:a979078b default
parent child Browse files
Show More
@@ -2129,5 +2129,25 class lazyset(object):
2129 2129 def set(self):
2130 2130 return set([r for r in self])
2131 2131
2132 class spanset(object):
2133 """Duck type for baseset class which represents a range of revisions and
2134 can work lazily and without having all the range in memory
2135 """
2136 def __init__(self, start, end):
2137 self._start = start
2138 self._end = end
2139
2140 def __iter__(self):
2141 if self._start <= self._end:
2142 for r in xrange(self._start, self._end):
2143 yield r
2144 else:
2145 for r in xrange(self._start, self._end, -1):
2146 yield r
2147
2148 def __contains__(self, x):
2149 return (x <= self._start and x > self._end) or (x >= self._start and x<
2150 self._end)
2151
2132 2152 # tell hggettext to extract docstrings from these functions:
2133 2153 i18nfunctions = symbols.values()
General Comments 0
You need to be logged in to leave comments. Login now