diff --git a/mercurial/commands.py b/mercurial/commands.py
index 78539633acf3b573e0adba8ea8e4125fc4e014a3_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..39dbf495880b8a439d912091109427d27a7e616a_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3037,7 +3037,9 @@
     totalsize = fulltotal + deltatotal
     avgchainlen = sum(chainlengths) / numrevs
     maxchainlen = max(chainlengths)
-    compratio = totalrawsize / totalsize
+    compratio = 1
+    if totalsize:
+        compratio = totalrawsize / totalsize
 
     basedfmtstr = '%%%dd\n'
     basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
@@ -3048,7 +3050,10 @@
         return basepcfmtstr % (len(str(max)), ' ' * padding)
 
     def pcfmt(value, total):
-        return (value, 100 * float(value) / total)
+        if total:
+            return (value, 100 * float(value) / total)
+        else:
+            return value, 100.0
 
     ui.write(('format : %d\n') % format)
     ui.write(('flags  : %s\n') % ', '.join(flags))