Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/deltas.py @ 40657:2eb48aa0acce
sparse-revlog: align endrevidx usages in the _slicechunktosize
All "startrevidx..endrevidx" ranges in this function are now half-open.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 15 Nov 2018 14:57:26 +0100 |
parents | fd1d41ccbe38 |
children | 39d29542fe40 |
comparison
equal
deleted
inserted
replaced
40654:fd1d41ccbe38 | 40657:2eb48aa0acce |
---|---|
232 if targetsize is None or fullspan <= targetsize: | 232 if targetsize is None or fullspan <= targetsize: |
233 yield revs | 233 yield revs |
234 return | 234 return |
235 | 235 |
236 startrevidx = 0 | 236 startrevidx = 0 |
237 endrevidx = 0 | 237 endrevidx = 1 |
238 iterrevs = enumerate(revs) | 238 iterrevs = enumerate(revs) |
239 next(iterrevs) # skip first rev. | 239 next(iterrevs) # skip first rev. |
240 # first step: get snapshots out of the way | 240 # first step: get snapshots out of the way |
241 for idx, r in iterrevs: | 241 for idx, r in iterrevs: |
242 span = revlog.end(r) - startdata | 242 span = revlog.end(r) - startdata |
243 snapshot = revlog.issnapshot(r) | 243 snapshot = revlog.issnapshot(r) |
244 if span <= targetsize and snapshot: | 244 if span <= targetsize and snapshot: |
245 endrevidx = idx | 245 endrevidx = idx + 1 |
246 else: | 246 else: |
247 chunk = _trimchunk(revlog, revs, startrevidx, endrevidx + 1) | 247 chunk = _trimchunk(revlog, revs, startrevidx, endrevidx) |
248 if chunk: | 248 if chunk: |
249 yield chunk | 249 yield chunk |
250 startrevidx = idx | 250 startrevidx = idx |
251 startdata = revlog.start(r) | 251 startdata = revlog.start(r) |
252 endrevidx = idx | 252 endrevidx = idx + 1 |
253 if not snapshot: | 253 if not snapshot: |
254 break | 254 break |
255 | 255 |
256 # for the others, we use binary slicing to quickly converge toward valid | 256 # for the others, we use binary slicing to quickly converge toward valid |
257 # chunks (otherwise, we might end up looking for start/end of many | 257 # chunks (otherwise, we might end up looking for start/end of many |