Mercurial > hg
changeset 17188:76e55914c303
debugrevlog: handle numrevs == numfull case (issue3537)
Instead of tracing back with a ZeroDivisionError.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Wed, 11 Jul 2012 11:52:42 +0200 |
parents | 293dd81e4601 |
children | 7199e82d6d8b |
files | mercurial/commands.py tests/test-debugcommands.t |
diffstat | 2 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Jul 10 09:11:53 2012 -0700 +++ b/mercurial/commands.py Wed Jul 11 11:52:42 2012 +0200 @@ -2245,6 +2245,11 @@ elif delta != nullrev: numother += 1 + # Adjust size min value for empty cases + for size in (datasize, fullsize, deltasize): + if size[0] is None: + size[0] = 0 + numdeltas = numrevs - numfull numoprev = numprev - nump1prev - nump2prev totalrawsize = datasize[2] @@ -2252,7 +2257,8 @@ fulltotal = fullsize[2] fullsize[2] /= numfull deltatotal = deltasize[2] - deltasize[2] /= numrevs - numfull + if numrevs - numfull > 0: + deltasize[2] /= numrevs - numfull totalsize = fulltotal + deltatotal avgchainlen = sum(chainlengths) / numrevs compratio = totalrawsize / totalsize
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-debugcommands.t Wed Jul 11 11:52:42 2012 +0200 @@ -0,0 +1,25 @@ + $ hg init debugrevlog + $ cd debugrevlog + $ echo a > a + $ hg ci -Am adda + adding a + $ hg debugrevlog -m + format : 1 + flags : inline + + revisions : 1 + merges : 0 ( 0.00%) + normal : 1 (100.00%) + revisions : 1 + full : 1 (100.00%) + deltas : 0 ( 0.00%) + revision size : 44 + full : 44 (100.00%) + deltas : 0 ( 0.00%) + + avg chain length : 0 + compression ratio : 0 + + uncompressed data size (min/max/avg) : 43 / 43 / 43 + full revision size (min/max/avg) : 44 / 44 / 44 + delta size (min/max/avg) : 0 / 0 / 0