changeset 42186:30033d56758f stable

debugrevlog: fix average size computation for empty data (issue6167) If the file has no full snapshot (eg: was always empty), `hg debugrevlog` would fails when trying to compute their average size.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 02 Jul 2019 10:53:29 +0200
parents 2c27b7fadcd3
children 50eacdeea88c
files mercurial/debugcommands.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sat Jun 29 23:23:07 2019 -0400
+++ b/mercurial/debugcommands.py	Tue Jul 02 10:53:29 2019 +0200
@@ -2274,7 +2274,10 @@
     totalrawsize = datasize[2]
     datasize[2] /= numrevs
     fulltotal = fullsize[2]
-    fullsize[2] /= numfull
+    if numfull == 0:
+        fullsize[2] = 0
+    else:
+        fullsize[2] /= numfull
     semitotal = semisize[2]
     snaptotal = {}
     if numsemi > 0: