Mercurial > hg-stable
changeset 35728:22a877215ea1
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.
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Fri, 19 Jan 2018 08:35:22 +0100 |
parents | 05c70675e5b9 |
children | 7415cc923613 |
files | mercurial/debugcommands.py |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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,