Mercurial > hg-stable
changeset 49777:7aea9babac5d
debugrevlog: display total stored information
This is an interesting statistis, so let's display it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 21 Nov 2022 15:04:19 +0100 |
parents | 511106bcb16c |
children | 45d7b8c380d7 |
files | mercurial/revlogutils/debug.py tests/test-debugcommands.t tests/test-sparse-revlog.t |
diffstat | 3 files changed, 29 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlogutils/debug.py Mon Nov 07 14:38:52 2022 -0500 +++ b/mercurial/revlogutils/debug.py Mon Nov 21 15:04:19 2022 +0100 @@ -288,6 +288,8 @@ if not flags: flags = [b'(none)'] + ### the total size of stored content if incompressed. + full_text_total_size = 0 ### tracks merge vs single parent nummerges = 0 @@ -347,7 +349,9 @@ p1, p2 = r.parentrevs(rev) delta = r.deltaparent(rev) if format > 0: - addsize(r.rawsize(rev), datasize) + s = r.rawsize(rev) + full_text_total_size += s + addsize(s, datasize) if p2 != nodemod.nullrev: nummerges += 1 size = r.length(rev) @@ -536,6 +540,18 @@ ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize)) ui.write(b'\n') + b_total = b"%d" % full_text_total_size + p_total = [] + while len(b_total) > 3: + p_total.append(b_total[-3:]) + b_total = b_total[:-3] + p_total.append(b_total) + p_total.reverse() + b_total = b' '.join(p_total) + + ui.write(b'\n') + ui.writenoi18n(b'total-stored-content: %s bytes\n' % b_total) + ui.write(b'\n') fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio)) ui.writenoi18n(b'avg chain length : ' + fmt % avgchainlen) ui.writenoi18n(b'max chain length : ' + fmt % maxchainlen)
--- a/tests/test-debugcommands.t Mon Nov 07 14:38:52 2022 -0500 +++ b/tests/test-debugcommands.t Mon Nov 21 15:04:19 2022 +0100 @@ -39,6 +39,9 @@ chunks size : 191 0x75 (u) : 191 (100.00%) + + total-stored-content: 188 bytes + avg chain length : 0 max chain length : 0 max chain reach : 67 @@ -74,6 +77,9 @@ empty : 0 ( 0.00%) 0x75 (u) : 88 (100.00%) + + total-stored-content: 86 bytes + avg chain length : 0 max chain length : 0 max chain reach : 44 @@ -107,6 +113,9 @@ chunks size : 3 0x75 (u) : 3 (100.00%) + + total-stored-content: 2 bytes + avg chain length : 0 max chain length : 0 max chain reach : 3
--- a/tests/test-sparse-revlog.t Mon Nov 07 14:38:52 2022 -0500 +++ b/tests/test-sparse-revlog.t Mon Nov 21 15:04:19 2022 +0100 @@ -126,6 +126,9 @@ chunks size : 58616973 0x28 : 58616973 (100.00%) + + total-stored-content: 1 732 705 361 bytes + avg chain length : 9 max chain length : 15 max chain reach : 27366701