Handle empty logs in repo.checksize
authorMatt Mackall <mpm@selenic.com>
Wed, 02 Nov 2005 20:09:19 -0800
changeset 1494 249ca10d37f4
parent 1493 1a216cb4ee64
child 1495 1e265c2bec94
Handle empty logs in repo.checksize
mercurial/revlog.py
--- a/mercurial/revlog.py	Wed Nov 02 19:26:23 2005 -0800
+++ b/mercurial/revlog.py	Wed Nov 02 20:09:19 2005 -0800
@@ -828,7 +828,14 @@
         expected = 0
         if self.count():
             expected = self.end(self.count() - 1)
-        f = self.opener(self.datafile)
-        f.seek(0, 2)
-        actual = f.tell()
-        return expected - actual
+        try:
+            f = self.opener(self.datafile)
+            f.seek(0, 2)
+            actual = f.tell()
+            return expected - actual
+        except IOError, inst:
+            if inst.errno == errno.ENOENT:
+                return 0
+            raise
+
+