diff mercurial/debugcommands.py @ 35678:43154a76f392

debugdeltachain: display how many chunks would be read in sparse-read mode
author Paul Morelle <paul.morelle@octobus.net>
date Mon, 16 Oct 2017 14:32:06 +0200
parents 35fb3367f72d
children 22a877215ea1
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Wed Jan 17 21:36:18 2018 +0000
+++ b/mercurial/debugcommands.py	Mon Oct 16 14:32:06 2017 +0200
@@ -600,6 +600,7 @@
                        (sum of the sizes of all the blocks)
     :``largestblock``: size of the largest block of data read from the disk
     :``readdensity``:  density of useful bytes in the data read from the disk
+    :``srchunks``:  in how many data hunks the whole revision would be read
 
     The sparse read can be enabled with experimental.sparse-read = True
     """
@@ -645,7 +646,7 @@
              'size    rawsize  chainsize     ratio   lindist extradist '
              'extraratio')
     if withsparseread:
-        fm.plain('   readsize largestblk rddensity')
+        fm.plain('   readsize largestblk rddensity srchunks')
     fm.plain('\n')
 
     chainbases = {}
@@ -693,11 +694,17 @@
 
             readdensity = float(chainsize) / float(readsize)
 
-            fm.write('readsize largestblock readdensity',
-                     ' %10d %10d %9.5f',
-                     readsize, largestblock, readdensity,
+            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,
                      readsize=readsize, largestblock=largestblock,
-                     readdensity=readdensity)
+                     readdensity=readdensity, srchunks=srchunks)
 
         fm.plain('\n')