Show More
@@ -10,7 +10,7 b' 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 httplib") |
|
12 | demandload(globals(), "hg os urllib urllib2 urlparse zlib util httplib") | |
13 | demandload(globals(), "keepalive tempfile socket") |
|
13 | demandload(globals(), "errno keepalive tempfile socket") | |
14 |
|
14 | |||
15 | class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): |
|
15 | class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): | |
16 | def __init__(self, ui): |
|
16 | def __init__(self, ui): | |
@@ -192,6 +192,10 b' class httprepository(remoterepository):' | |||||
192 | cu = "%s?%s" % (self.url, qs) |
|
192 | cu = "%s?%s" % (self.url, qs) | |
193 | try: |
|
193 | try: | |
194 | resp = urllib2.urlopen(urllib2.Request(cu, data, headers)) |
|
194 | resp = urllib2.urlopen(urllib2.Request(cu, data, headers)) | |
|
195 | except urllib2.HTTPError, inst: | |||
|
196 | if inst.code == 401: | |||
|
197 | raise util.Abort(_('authorization failed')) | |||
|
198 | raise | |||
195 | except httplib.HTTPException, inst: |
|
199 | except httplib.HTTPException, inst: | |
196 | self.ui.debug(_('http error while sending %s command\n') % cmd) |
|
200 | self.ui.debug(_('http error while sending %s command\n') % cmd) | |
197 | self.ui.print_exc() |
|
201 | self.ui.print_exc() | |
@@ -278,6 +282,7 b' class httprepository(remoterepository):' | |||||
278 | for chunk in util.filechunkiter(cg): |
|
282 | for chunk in util.filechunkiter(cg): | |
279 | fp.write(chunk) |
|
283 | fp.write(chunk) | |
280 | length = fp.tell() |
|
284 | length = fp.tell() | |
|
285 | try: | |||
281 | rfp = self.do_cmd( |
|
286 | rfp = self.do_cmd( | |
282 | 'unbundle', data=fp, |
|
287 | 'unbundle', data=fp, | |
283 | headers={'content-length': length, |
|
288 | headers={'content-length': length, | |
@@ -289,6 +294,10 b' class httprepository(remoterepository):' | |||||
289 | return ret |
|
294 | return ret | |
290 | finally: |
|
295 | finally: | |
291 | rfp.close() |
|
296 | rfp.close() | |
|
297 | except socket.error, err: | |||
|
298 | if err[0] in (errno.ECONNRESET, errno.EPIPE): | |||
|
299 | raise util.Abort(_('push failed: %s'), err[1]) | |||
|
300 | raise util.Abort(err[1]) | |||
292 | finally: |
|
301 | finally: | |
293 | fp.close() |
|
302 | fp.close() | |
294 | os.unlink(tempname) |
|
303 | os.unlink(tempname) |
General Comments 0
You need to be logged in to leave comments.
Login now