debugdeltachain: cleanup the double call to _slicechunk
Follow-up to Yuya's review on
43154a76f3927c4f0c8c6b02be80f0069c7d8fdb:
> Nit: hasattr() isn't necessary. revlog._slicechunk() is used in the previous
> block.
hasattr() isn't necessary indeed, as we are protected by the withsparseread
option, which was introduced at the same time as revlog._slicechunk, in
e2ad93bcc084b97c48f54c179365376edb702858.
And, as Yuya noticed, _slicechunk could be called only once.
--- a/mercurial/debugcommands.py Fri Jan 19 14:10:18 2018 +0530
+++ b/mercurial/debugcommands.py Fri Jan 19 08:35:22 2018 +0100
@@ -684,7 +684,10 @@
if withsparseread:
readsize = 0
largestblock = 0
+ srchunks = 0
+
for revschunk in revlog._slicechunk(r, chain):
+ srchunks += 1
blkend = start(revschunk[-1]) + length(revschunk[-1])
blksize = blkend - start(revschunk[0])
@@ -694,12 +697,6 @@
readdensity = float(chainsize) / float(readsize)
- if util.safehasattr(revlog, '_slicechunk'):
- revchunks = tuple(revlog._slicechunk(r, chain))
- else:
- revchunks = (chain,)
- srchunks = len(revchunks)
-
fm.write('readsize largestblock readdensity srchunks',
' %10d %10d %9.5f %8d',
readsize, largestblock, readdensity, srchunks,