Mercurial > hg
diff mercurial/debugcommands.py @ 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 |
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)