# HG changeset patch # User Pierre-Yves David # Date 1669039459 -3600 # Node ID 7aea9babac5d4aad486396f1d765464ce45b767c # Parent 511106bcb16ca0e1ca496fb2e966a76b892a3a0a debugrevlog: display total stored information This is an interesting statistis, so let's display it. diff -r 511106bcb16c -r 7aea9babac5d mercurial/revlogutils/debug.py --- 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) diff -r 511106bcb16c -r 7aea9babac5d tests/test-debugcommands.t --- 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 diff -r 511106bcb16c -r 7aea9babac5d tests/test-sparse-revlog.t --- 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