Show More
@@ -275,8 +275,7 b' def _slicechunktodensity(revlog, revs, t' | |||||
275 | return |
|
275 | return | |
276 |
|
276 | |||
277 | # Store the gaps in a heap to have them sorted by decreasing size |
|
277 | # Store the gaps in a heap to have them sorted by decreasing size | |
278 |
gaps |
|
278 | gaps = [] | |
279 | heapq.heapify(gapsheap) |
|
|||
280 | prevend = None |
|
279 | prevend = None | |
281 | for i, rev in enumerate(revs): |
|
280 | for i, rev in enumerate(revs): | |
282 | revstart = start(rev) |
|
281 | revstart = start(rev) | |
@@ -290,21 +289,23 b' def _slicechunktodensity(revlog, revs, t' | |||||
290 | gapsize = revstart - prevend |
|
289 | gapsize = revstart - prevend | |
291 | # only consider holes that are large enough |
|
290 | # only consider holes that are large enough | |
292 | if gapsize > mingapsize: |
|
291 | if gapsize > mingapsize: | |
293 |
|
|
292 | gaps.append((gapsize, i)) | |
294 |
|
293 | |||
295 | prevend = revstart + revlen |
|
294 | prevend = revstart + revlen | |
|
295 | # sort the gaps to pop them from largest to small | |||
|
296 | gaps.sort() | |||
296 |
|
297 | |||
297 | # Collect the indices of the largest holes until the density is acceptable |
|
298 | # Collect the indices of the largest holes until the density is acceptable | |
298 | indicesheap = [] |
|
299 | indicesheap = [] | |
299 | heapq.heapify(indicesheap) |
|
300 | heapq.heapify(indicesheap) | |
300 |
while gaps |
|
301 | while gaps and density < targetdensity: | |
301 |
|
|
302 | gapsize, gapidx = gaps.pop() | |
302 |
|
303 | |||
303 | heapq.heappush(indicesheap, gapidx) |
|
304 | heapq.heappush(indicesheap, gapidx) | |
304 |
|
305 | |||
305 | # the gap sizes are stored as negatives to be sorted decreasingly |
|
306 | # the gap sizes are stored as negatives to be sorted decreasingly | |
306 | # by the heap |
|
307 | # by the heap | |
307 |
readdata -= |
|
308 | readdata -= gapsize | |
308 | if readdata > 0: |
|
309 | if readdata > 0: | |
309 | density = chainpayload / float(readdata) |
|
310 | density = chainpayload / float(readdata) | |
310 | else: |
|
311 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now