Mercurial > hg-stable
changeset 39184:07b82f55f351
debugrevlog: include information about intermediate snapshots
As we are about to create intermediate snapshots, we need to have a way to
debug them. We start by adding very simple debug output and more detailed
output will comes in next changesets.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 27 Jul 2018 10:52:43 +0200 |
parents | f39efa885a6d |
children | 3b1042cab4b4 |
files | mercurial/debugcommands.py tests/test-debugcommands.t |
diffstat | 2 files changed, 20 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Fri Jul 20 13:34:48 2018 +0200 +++ b/mercurial/debugcommands.py Fri Jul 27 10:52:43 2018 +0200 @@ -2095,6 +2095,8 @@ numemptydelta = 0 # full file content numfull = 0 + # intermediate snapshot against a prior snapshot + numsemi = 0 # delta against previous revision numprev = 0 # delta against first or second parent (not prev) @@ -2115,6 +2117,7 @@ # data about each revision datasize = [None, 0, 0] fullsize = [None, 0, 0] + semisize = [None, 0, 0] deltasize = [None, 0, 0] chunktypecounts = {} chunktypesizes = {} @@ -2154,6 +2157,9 @@ if size == 0: numempty += 1 numemptydelta += 1 + elif r.issnapshot(rev): + addsize(size, semisize) + numsemi += 1 else: addsize(size, deltasize) if delta == rev - 1: @@ -2187,20 +2193,23 @@ chunktypesizes[chunktype] += size # Adjust size min value for empty cases - for size in (datasize, fullsize, deltasize): + for size in (datasize, fullsize, semisize, deltasize): if size[0] is None: size[0] = 0 - numdeltas = numrevs - numfull - numempty + numdeltas = numrevs - numfull - numempty - numsemi numoprev = numprev - nump1prev - nump2prev totalrawsize = datasize[2] datasize[2] /= numrevs fulltotal = fullsize[2] fullsize[2] /= numfull + semitotal = semisize[2] + if 0 < numsemi: + semisize[2] /= numsemi deltatotal = deltasize[2] if numdeltas > 0: deltasize[2] /= numdeltas - totalsize = fulltotal + deltatotal + totalsize = fulltotal + semitotal + deltatotal avgchainlen = sum(chainlengths) / numrevs maxchainlen = max(chainlengths) maxchainspan = max(chainspans) @@ -2238,9 +2247,11 @@ ui.write((' delta : ') + fmt % pcfmt(numemptydelta, numemptytext + numemptydelta)) ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) + ui.write((' inter : ') + fmt % pcfmt(numsemi, numrevs)) ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) ui.write(('revision size : ') + fmt2 % totalsize) ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) + ui.write((' inter : ') + fmt % pcfmt(semitotal, totalsize)) ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) def fmtchunktype(chunktype):
--- a/tests/test-debugcommands.t Fri Jul 20 13:34:48 2018 +0200 +++ b/tests/test-debugcommands.t Fri Jul 27 10:52:43 2018 +0200 @@ -27,9 +27,11 @@ text : 0 (100.00%) delta : 0 (100.00%) full : 3 (100.00%) + inter : 0 ( 0.00%) deltas : 0 ( 0.00%) revision size : 191 full : 191 (100.00%) + inter : 0 ( 0.00%) deltas : 0 ( 0.00%) chunks : 3 @@ -57,9 +59,11 @@ text : 1 (100.00%) delta : 0 ( 0.00%) full : 2 (66.67%) + inter : 0 ( 0.00%) deltas : 0 ( 0.00%) revision size : 88 full : 88 (100.00%) + inter : 0 ( 0.00%) deltas : 0 ( 0.00%) chunks : 3 @@ -89,9 +93,11 @@ text : 0 (100.00%) delta : 0 (100.00%) full : 1 (100.00%) + inter : 0 ( 0.00%) deltas : 0 ( 0.00%) revision size : 3 full : 3 (100.00%) + inter : 0 ( 0.00%) deltas : 0 ( 0.00%) chunks : 1