changeset 1322:b3d44e9b3092

Make revlog constructor more discerning in its treatment of errors.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 22 Sep 2005 23:31:44 -0700
parents b47f96a178a3
children 60200b3fc839
files mercurial/revlog.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Sep 22 23:19:47 2005 -0700
+++ b/mercurial/revlog.py	Thu Sep 22 23:31:44 2005 -0700
@@ -10,9 +10,9 @@
 of the GNU General Public License, incorporated herein by reference.
 """
 
-import zlib, struct, sha, binascii, heapq
-import mdiff
 from node import *
+from demandload import demandload
+demandload(globals(), "binascii errno heapq mdiff sha struct urllib2 zlib")
 
 def hash(text, p1, p2):
     """generate a hash from the given text and its parent hashes
@@ -179,7 +179,11 @@
 
         try:
             i = self.opener(self.indexfile).read()
-        except IOError:
+        except urllib2.URLError:
+            raise
+        except IOError, inst:
+            if inst.errno != errno.ENOENT:
+                raise
             i = ""
 
         if len(i) > 10000: