[PATCH STABLE] debugrevlog: fix average size computation for empty data (issue6167)
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Jul 2 09:01:21 UTC 2019
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1562057609 -7200
# Tue Jul 02 10:53:29 2019 +0200
# Branch stable
# Node ID 9577ba917f59da7bd14c8d9d0e1f03545f5a8e83
# Parent 2c27b7fadcd3afabdcd9f72a6984166a8f6e39f4
# EXP-Topic issue6167
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9577ba917f59
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.
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2274,7 +2274,10 @@ def debugrevlog(ui, repo, file_=None, **
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:
More information about the Mercurial-devel
mailing list