[PATCH] commands.debugrevlog: report max chain length

Augie Fackler raf at durin42.com
Mon Mar 30 09:46:01 CDT 2015


On Sat, Mar 28, 2015 at 01:03:28PM -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at 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 at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list