Mercurial > hg
changeset 39081:195ed920653e
debugrevlog: track empty revlog entries
A revlog entry can be "empty" for two reasons:
* the stored text is empty
* we found another entry with the exact same content
Tracking them separately make revlog content clearer.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 27 Jul 2018 19:19:52 +0200 |
parents | 5c99486fcfe1 |
children | a456c603a83d |
files | mercurial/debugcommands.py tests/test-debugcommands.t |
diffstat | 2 files changed, 29 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Fri Jul 27 10:59:59 2018 +0200 +++ b/mercurial/debugcommands.py Fri Jul 27 19:19:52 2018 +0200 @@ -2089,6 +2089,8 @@ nummerges = 0 ### tracks ways the "delta" are build + # nodelta + numempty = 0 # full file content numfull = 0 # delta against previous revision @@ -2135,27 +2137,33 @@ chainlengths.append(0) chainbases.append(r.start(rev)) chainspans.append(size) - numfull += 1 - addsize(size, fullsize) + if size == 0: + numempty += 1 + else: + numfull += 1 + addsize(size, fullsize) else: chainlengths.append(chainlengths[delta] + 1) baseaddr = chainbases[delta] revaddr = r.start(rev) chainbases.append(baseaddr) chainspans.append((revaddr - baseaddr) + size) - addsize(size, deltasize) - if delta == rev - 1: - numprev += 1 - if delta == p1: - nump1prev += 1 + if size == 0: + numempty += 1 + else: + addsize(size, deltasize) + if delta == rev - 1: + numprev += 1 + if delta == p1: + nump1prev += 1 + elif delta == p2: + nump2prev += 1 + elif delta == p1: + nump1 += 1 elif delta == p2: - nump2prev += 1 - elif delta == p1: - nump1 += 1 - elif delta == p2: - nump2 += 1 - elif delta != nullrev: - numother += 1 + nump2 += 1 + elif delta != nullrev: + numother += 1 # Obtain data on the raw chunks in the revlog. segment = r._getsegmentforrevs(rev, rev)[1] @@ -2176,15 +2184,15 @@ if size[0] is None: size[0] = 0 - numdeltas = numrevs - numfull + numdeltas = numrevs - numfull - numempty numoprev = numprev - nump1prev - nump2prev totalrawsize = datasize[2] datasize[2] /= numrevs fulltotal = fullsize[2] fullsize[2] /= numfull deltatotal = deltasize[2] - if numrevs - numfull > 0: - deltasize[2] /= numrevs - numfull + if numdeltas > 0: + deltasize[2] /= numdeltas totalsize = fulltotal + deltatotal avgchainlen = sum(chainlengths) / numrevs maxchainlen = max(chainlengths) @@ -2217,6 +2225,7 @@ ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) ui.write(('revisions : ') + fmt2 % numrevs) + ui.write((' empty : ') + fmt % pcfmt(numempty, numrevs)) ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) ui.write(('revision size : ') + fmt2 % totalsize)
--- a/tests/test-debugcommands.t Fri Jul 27 10:59:59 2018 +0200 +++ b/tests/test-debugcommands.t Fri Jul 27 19:19:52 2018 +0200 @@ -23,7 +23,8 @@ merges : 0 ( 0.00%) normal : 3 (100.00%) revisions : 3 - full : 3 (100.00%) + empty : 1 (33.33%) + full : 2 (66.67%) deltas : 0 ( 0.00%) revision size : 88 full : 88 (100.00%) @@ -42,7 +43,7 @@ compression ratio : 0 uncompressed data size (min/max/avg) : 0 / 43 / 28 - full revision size (min/max/avg) : 0 / 44 / 29 + full revision size (min/max/avg) : 44 / 44 / 44 delta size (min/max/avg) : 0 / 0 / 0 #endif