Patchwork debugrevlog: align chain length, reach, and compression ratio

login
register
mail settings
Submitter Yuya Nishihara
Date June 26, 2017, 1:54 p.m.
Message ID <e21b750c9b9efa96517e.1498485262@mimosa>
Download mbox | patch
Permalink /patch/21736/
State Accepted
Headers show

Comments

Yuya Nishihara - June 26, 2017, 1:54 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1498483654 -32400
#      Mon Jun 26 22:27:34 2017 +0900
# Node ID e21b750c9b9efa96517e74c7fc045350c02dc466
# Parent  c41cbe98822c5cd5a9a776d47b90c25e2ee11063
debugrevlog: align chain length, reach, and compression ratio

I think this is what the max(...) exists for.
Augie Fackler - June 26, 2017, 2:29 p.m.
On Mon, Jun 26, 2017 at 10:54:22PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1498483654 -32400
> #      Mon Jun 26 22:27:34 2017 +0900
> # Node ID e21b750c9b9efa96517e74c7fc045350c02dc466
> # Parent  c41cbe98822c5cd5a9a776d47b90c25e2ee11063
> debugrevlog: align chain length, reach, and compression ratio

queued, thanks

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1885,10 +1885,10 @@  def debugrevlog(ui, repo, file_=None, **
         ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
 
     ui.write('\n')
-    fmt = dfmtstr(max(avgchainlen, compratio))
+    fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
     ui.write(('avg chain length  : ') + fmt % avgchainlen)
     ui.write(('max chain length  : ') + fmt % maxchainlen)
-    ui.write(('max chain reach  : ') + fmt % maxchainspan)
+    ui.write(('max chain reach   : ') + fmt % maxchainspan)
     ui.write(('compression ratio : ') + fmt % compratio)
 
     if format > 0:
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -27,10 +27,10 @@ 
   chunks size   : 44
       0x75 (u)  : 44 (100.00%)
   
-  avg chain length  : 0
-  max chain length  : 0
-  max chain reach  : 44
-  compression ratio : 0
+  avg chain length  :  0
+  max chain length  :  0
+  max chain reach   : 44
+  compression ratio :  0
   
   uncompressed data size (min/max/avg) : 43 / 43 / 43
   full revision size (min/max/avg)     : 44 / 44 / 44