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