##// END OF EJS Templates
revlog: postprocess chunk to slice them down to a certain size...
Boris Feld -
r38665:967fee55 default
parent child Browse files
Show More
@@ -293,7 +293,7 b' def _segmentspan(revlog, revs):'
293 return 0
293 return 0
294 return revlog.end(revs[-1]) - revlog.start(revs[0])
294 return revlog.end(revs[-1]) - revlog.start(revs[0])
295
295
296 def _slicechunk(revlog, revs):
296 def _slicechunk(revlog, revs, targetsize=None):
297 """slice revs to reduce the amount of unrelated data to be read from disk.
297 """slice revs to reduce the amount of unrelated data to be read from disk.
298
298
299 ``revs`` is sliced into groups that should be read in one time.
299 ``revs`` is sliced into groups that should be read in one time.
@@ -303,6 +303,13 b' def _slicechunk(revlog, revs):'
303 ratio) is above `revlog._srdensitythreshold`. No gap smaller than
303 ratio) is above `revlog._srdensitythreshold`. No gap smaller than
304 `revlog._srmingapsize` is skipped.
304 `revlog._srmingapsize` is skipped.
305
305
306 If `targetsize` is set, no chunk larger than `targetsize` will be yield.
307 For consistency with other slicing choice, this limit won't go lower than
308 `revlog._srmingapsize`.
309
310 If individual revisions chunk are larger than this limit, they will still
311 be raised individually.
312
306 >>> revlog = _testrevlog([
313 >>> revlog = _testrevlog([
307 ... 5, #00 (5)
314 ... 5, #00 (5)
308 ... 10, #01 (5)
315 ... 10, #01 (5)
@@ -332,11 +339,20 b' def _slicechunk(revlog, revs):'
332 [[0], [11, 13, 15]]
339 [[0], [11, 13, 15]]
333 >>> list(_slicechunk(revlog, [1, 2, 3, 5, 8, 10, 11, 14]))
340 >>> list(_slicechunk(revlog, [1, 2, 3, 5, 8, 10, 11, 14]))
334 [[1, 2], [5, 8, 10, 11], [14]]
341 [[1, 2], [5, 8, 10, 11], [14]]
342
343 Slicing with a maximum chunk size
344 >>> list(_slicechunk(revlog, [0, 11, 13, 15], 15))
345 [[0], [11], [13], [15]]
346 >>> list(_slicechunk(revlog, [0, 11, 13, 15], 20))
347 [[0], [11], [13, 15]]
335 """
348 """
349 if targetsize is not None:
350 targetsize = max(targetsize, revlog._srmingapsize)
336 for chunk in _slicechunktodensity(revlog, revs,
351 for chunk in _slicechunktodensity(revlog, revs,
337 revlog._srdensitythreshold,
352 revlog._srdensitythreshold,
338 revlog._srmingapsize):
353 revlog._srmingapsize):
339 yield chunk
354 for subchunk in _slicechunktosize(revlog, chunk, targetsize):
355 yield subchunk
340
356
341 def _slicechunktosize(revlog, revs, targetsize):
357 def _slicechunktosize(revlog, revs, targetsize):
342 """slice revs to match the target size
358 """slice revs to match the target size
General Comments 0
You need to be logged in to leave comments. Login now