diff tests/test-debugcommands.t @ 27263:4efb36ecaaec

commands: add debugdeltachain command We have debug commands for displaying overall revlog statistics (debugrevlog) and for dumping a revlog index (debugindex). As part of investigating various aspects of revlog behavior and performance, I found it important to have an understanding of how revlog delta chains behave in practice. This patch implements a "debugdeltachain" command. For each revision in a revlog, it dumps information about the delta chain. Which delta chain it is part of, length of the delta chain, distance since base revision, info about base revision, size of the delta chain, etc. The generic formatting facility is used, which means we can templatize output and get machine readable output like JSON. This command has already uncovered some weird history in mozilla-central I didn't know about. So I think it's valuable.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 05 Dec 2015 23:37:46 -0800
parents 0438df737fb7
children 932b18c95e11
line wrap: on
line diff
--- a/tests/test-debugcommands.t	Sat Oct 24 19:56:39 2015 +0100
+++ b/tests/test-debugcommands.t	Sat Dec 05 23:37:46 2015 -0800
@@ -44,6 +44,32 @@
      rev flag   offset   length     size  .....   link     p1     p2                                   nodeid (re)
        0 0000        0        3        2   ....      0     -1     -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (re)
 
+debugdelta chain basic output
+
+  $ hg debugdeltachain -m
+      rev  chain# chainlen     prev   delta       size    rawsize  chainsize     ratio   lindist extradist extraratio
+        0       1        1       -1    base         44         43         44   1.02326        44         0    0.00000
+
+  $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
+  0 1 1
+
+  $ hg debugdeltachain -m -Tjson
+  [
+   {
+    "chainid": 1,
+    "chainlen": 1,
+    "chainratio": 1.02325581395,
+    "chainsize": 44,
+    "compsize": 44,
+    "deltatype": "base",
+    "extradist": 0,
+    "extraratio": 0.0,
+    "lindist": 44,
+    "prevrev": -1,
+    "rev": 0,
+    "uncompsize": 43
+   }
+  ]
 
 Test max chain len
   $ cat >> $HGRCPATH << EOF