##// END OF EJS Templates
Catch HTTPException when reading from remote http repository....
Thomas Arendsen Hein -
r2015:1a09814a default
parent child Browse files
Show More
@@ -9,7 +9,7 b' from node import *'
9 from remoterepo import *
9 from remoterepo import *
10 from i18n import gettext as _
10 from i18n import gettext as _
11 from demandload import *
11 from demandload import *
12 demandload(globals(), "hg os urllib urllib2 urlparse zlib util")
12 demandload(globals(), "hg os urllib urllib2 urlparse zlib util httplib")
13
13
14 class httprepository(remoterepository):
14 class httprepository(remoterepository):
15 def __init__(self, ui, path):
15 def __init__(self, ui, path):
@@ -129,8 +129,11 b' class httprepository(remoterepository):'
129
129
130 def zgenerator(f):
130 def zgenerator(f):
131 zd = zlib.decompressobj()
131 zd = zlib.decompressobj()
132 try:
132 for chnk in f:
133 for chnk in f:
133 yield zd.decompress(chnk)
134 yield zd.decompress(chnk)
135 except httplib.HTTPException, inst:
136 raise IOError(None, _('connection ended unexpectedly'))
134 yield zd.flush()
137 yield zd.flush()
135
138
136 return util.chunkbuffer(zgenerator(util.filechunkiter(f)))
139 return util.chunkbuffer(zgenerator(util.filechunkiter(f)))
General Comments 0
You need to be logged in to leave comments. Login now