mercurial/statichttprepo.py
changeset 1325 57220daf40e9
parent 1101 2cf5c8a4eae5
child 1598 14d1f1868bf6
child 1677 11d12bd6e1dc
--- a/mercurial/statichttprepo.py	Thu Sep 22 23:33:26 2005 -0700
+++ b/mercurial/statichttprepo.py	Fri Sep 23 00:05:16 2005 -0700
@@ -7,15 +7,23 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import os, urllib
-import localrepo, httprangereader, filelog, manifest, changelog
+from demandload import demandload
+demandload(globals(), "changelog filelog httprangereader")
+demandload(globals(), "localrepo manifest os urllib urllib2")
+
+class rangereader(httprangereader.httprangereader):
+    def read(self, size=None):
+        try:
+            return httprangereader.httprangereader.read(self, size)
+        except urllib2.URLError, inst:
+            raise IOError(None, str(inst))
 
 def opener(base):
     """return a function that opens files over http"""
     p = base
     def o(path, mode="r"):
         f = os.path.join(p, urllib.quote(path))
-        return httprangereader.httprangereader(f)
+        return rangereader(f)
     return o
 
 class statichttprepository(localrepo.localrepository):