Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 20525:aa73a6327df4
revset: changed spanset to take a repo argument
This way, we can have by default the length of the repo as the end argument
and less code has to be aware of hidden revisions.
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Tue, 18 Feb 2014 11:38:03 -0800 |
parents | 1850a7f5fb66 |
children | 9ad6dae67845 |
comparison
equal
deleted
inserted
replaced
20524:28b8ff84db3f | 20525:aa73a6327df4 |
---|---|
2164 | 2164 |
2165 class spanset(object): | 2165 class spanset(object): |
2166 """Duck type for baseset class which represents a range of revisions and | 2166 """Duck type for baseset class which represents a range of revisions and |
2167 can work lazily and without having all the range in memory | 2167 can work lazily and without having all the range in memory |
2168 """ | 2168 """ |
2169 def __init__(self, start, end, hiddenrevs=set()): | 2169 def __init__(self, repo, start=0, end=None): |
2170 self._start = start | 2170 self._start = start |
2171 self._end = end | 2171 if end is not None: |
2172 self._hiddenrevs = hiddenrevs | 2172 self._end = end |
2173 else: | |
2174 self._end = len(repo) | |
2175 self._hiddenrevs = repo.changelog.filteredrevs | |
2173 | 2176 |
2174 def _contained(self, rev): | 2177 def _contained(self, rev): |
2175 return (rev <= self._start and rev > self._end) or (rev >= self._start | 2178 return (rev <= self._start and rev > self._end) or (rev >= self._start |
2176 and rev < self._end) | 2179 and rev < self._end) |
2177 | 2180 |