[PATCH] commands.debugrevlog: report max chain length
Gregory Szorc
gregory.szorc at gmail.com
Sat Mar 28 20:03:28 UTC 2015
# 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
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
More information about the Mercurial-devel
mailing list