##// END OF EJS Templates
revlog: document and test _slicechunk
Boris Feld -
r38659:f62b8fb0 default
parent child Browse files
Show More
@@ -298,6 +298,40 b' def _slicechunk(revlog, revs):'
298 298
299 299 ``revs`` is sliced into groups that should be read in one time.
300 300 Assume that revs are sorted.
301
302 The initial chunk is sliced until the overall density (payload/chunks-span
303 ratio) is above `revlog._srdensitythreshold`. No gap smaller than
304 `revlog._srmingapsize` is skipped.
305
306 >>> revlog = _testrevlog([
307 ... 5, #00 (5)
308 ... 10, #01 (5)
309 ... 12, #02 (2)
310 ... 12, #03 (empty)
311 ... 27, #04 (15)
312 ... 31, #05 (4)
313 ... 31, #06 (empty)
314 ... 42, #07 (11)
315 ... 47, #08 (5)
316 ... 47, #09 (empty)
317 ... 48, #10 (1)
318 ... 51, #11 (3)
319 ... 74, #12 (23)
320 ... 85, #13 (11)
321 ... 86, #14 (1)
322 ... 91, #15 (5)
323 ... ])
324
325 >>> list(_slicechunk(revlog, range(16)))
326 [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]]
327 >>> list(_slicechunk(revlog, [0, 15]))
328 [[0], [15]]
329 >>> list(_slicechunk(revlog, [0, 11, 15]))
330 [[0], [11], [15]]
331 >>> list(_slicechunk(revlog, [0, 11, 13, 15]))
332 [[0], [11, 13, 15]]
333 >>> list(_slicechunk(revlog, [1, 2, 3, 5, 8, 10, 11, 14]))
334 [[1, 2], [5, 8, 10, 11], [14]]
301 335 """
302 336 start = revlog.start
303 337 length = revlog.length
General Comments 0
You need to be logged in to leave comments. Login now