[PATCH] localrepo: stream_in may raise ZeroDivisionError with nul float elapsed argument

Patrick Mezard pmezard at gmail.com
Mon Feb 19 09:29:31 UTC 2007


# HG changeset patch
# User Patrick Mezard <pmezard at gmail.com>
# Date 1171877345 -3600
# Node ID cc3c783b0030ee1275476973c97c49a81c1d1c13
# Parent  7616d268eaf94bf50ab835937cb9202078c7ddad
localrepo: stream_in may raise ZeroDivisionError with nul float elapsed argument.

diff -r 7616d268eaf9 -r cc3c783b0030 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Feb 19 09:59:37 2007 +0100
+++ b/mercurial/localrepo.py	Mon Feb 19 10:29:05 2007 +0100
@@ -1867,6 +1867,8 @@ class localrepository(repo.repository):
                 ofp.write(chunk)
             ofp.close()
         elapsed = time.time() - start
+        if elapsed <= 0:
+            elapsed = 0.001
         self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') %
                        (util.bytecount(total_bytes), elapsed,
                         util.bytecount(total_bytes / elapsed)))



More information about the Mercurial-devel mailing list