Mercurial > hg
comparison mercurial/ancestor.py @ 23328:3a7d9c0c57a5
ancestor.lazyancestors: take parentrevs function rather than changelog
Principle of least privilege, and it also brings this in line with
missingancestors.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 14 Nov 2014 14:36:25 -0800 |
parents | baecf4e1b7d0 |
children | 194508240dc9 |
comparison
equal
deleted
inserted
replaced
23327:bd296bb4b5c8 | 23328:3a7d9c0c57a5 |
---|---|
214 | 214 |
215 missing.reverse() | 215 missing.reverse() |
216 return missing | 216 return missing |
217 | 217 |
218 class lazyancestors(object): | 218 class lazyancestors(object): |
219 def __init__(self, cl, revs, stoprev=0, inclusive=False): | 219 def __init__(self, pfunc, revs, stoprev=0, inclusive=False): |
220 """Create a new object generating ancestors for the given revs. Does | 220 """Create a new object generating ancestors for the given revs. Does |
221 not generate revs lower than stoprev. | 221 not generate revs lower than stoprev. |
222 | 222 |
223 This is computed lazily starting from revs. The object supports | 223 This is computed lazily starting from revs. The object supports |
224 iteration and membership. | 224 iteration and membership. |
226 cl should be a changelog and revs should be an iterable. inclusive is | 226 cl should be a changelog and revs should be an iterable. inclusive is |
227 a boolean that indicates whether revs should be included. Revs lower | 227 a boolean that indicates whether revs should be included. Revs lower |
228 than stoprev will not be generated. | 228 than stoprev will not be generated. |
229 | 229 |
230 Result does not include the null revision.""" | 230 Result does not include the null revision.""" |
231 self._parentrevs = cl.parentrevs | 231 self._parentrevs = pfunc |
232 self._initrevs = revs | 232 self._initrevs = revs |
233 self._stoprev = stoprev | 233 self._stoprev = stoprev |
234 self._inclusive = inclusive | 234 self._inclusive = inclusive |
235 | 235 |
236 # Initialize data structures for __contains__. | 236 # Initialize data structures for __contains__. |