Patchwork commands.debugrevlog: report max chain length

login
register
mail settings
Submitter Gregory Szorc
Date March 28, 2015, 8:03 p.m.
Message ID <4674d72785291031be6d.1427573008@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/8332/
State Accepted
Headers show

Comments

Gregory Szorc - March 28, 2015, 8:03 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1427572724 25200
#      Sat Mar 28 12:58:44 2015 -0700
# Node ID 4674d72785291031be6dece42fda214738bb2448
# Parent  efa094701a05d58d505c3b0c3b3c73dba4e51e97
commands.debugrevlog: report max chain length

This is sometimes useful to know. Report it.
Augie Fackler - March 30, 2015, 2:46 p.m.
On Sat, Mar 28, 2015 at 01:03:28PM -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1427572724 25200
> #      Sat Mar 28 12:58:44 2015 -0700
> # Node ID 4674d72785291031be6dece42fda214738bb2448
> # Parent  efa094701a05d58d505c3b0c3b3c73dba4e51e97
> commands.debugrevlog: report max chain length

sure, queued

>
> This is sometimes useful to know. Report it.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2842,8 +2842,9 @@ def debugrevlog(ui, repo, file_=None, **
>      if numrevs - numfull > 0:
>          deltasize[2] /= numrevs - numfull
>      totalsize = fulltotal + deltatotal
>      avgchainlen = sum(chainlengths) / numrevs
> +    maxchainlen = max(chainlengths)
>      compratio = totalrawsize / totalsize
>
>      basedfmtstr = '%%%dd\n'
>      basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
> @@ -2874,8 +2875,9 @@ def debugrevlog(ui, repo, file_=None, **
>
>      ui.write('\n')
>      fmt = dfmtstr(max(avgchainlen, compratio))
>      ui.write(('avg chain length  : ') + fmt % avgchainlen)
> +    ui.write(('max chain length  : ') + fmt % maxchainlen)
>      ui.write(('compression ratio : ') + fmt % compratio)
>
>      if format > 0:
>          ui.write('\n')
> diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
> --- a/tests/test-debugcommands.t
> +++ b/tests/test-debugcommands.t
> @@ -17,8 +17,9 @@
>        full      : 44 (100.00%)
>        deltas    :  0 ( 0.00%)
>
>    avg chain length  : 0
> +  max chain length  : 0
>    compression ratio : 0
>
>    uncompressed data size (min/max/avg) : 43 / 43 / 43
>    full revision size (min/max/avg)     : 44 / 44 / 44
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2842,8 +2842,9 @@  def debugrevlog(ui, repo, file_=None, **
     if numrevs - numfull > 0:
         deltasize[2] /= numrevs - numfull
     totalsize = fulltotal + deltatotal
     avgchainlen = sum(chainlengths) / numrevs
+    maxchainlen = max(chainlengths)
     compratio = totalrawsize / totalsize
 
     basedfmtstr = '%%%dd\n'
     basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
@@ -2874,8 +2875,9 @@  def debugrevlog(ui, repo, file_=None, **
 
     ui.write('\n')
     fmt = dfmtstr(max(avgchainlen, compratio))
     ui.write(('avg chain length  : ') + fmt % avgchainlen)
+    ui.write(('max chain length  : ') + fmt % maxchainlen)
     ui.write(('compression ratio : ') + fmt % compratio)
 
     if format > 0:
         ui.write('\n')
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -17,8 +17,9 @@ 
       full      : 44 (100.00%)
       deltas    :  0 ( 0.00%)
   
   avg chain length  : 0
+  max chain length  : 0
   compression ratio : 0
   
   uncompressed data size (min/max/avg) : 43 / 43 / 43
   full revision size (min/max/avg)     : 44 / 44 / 44