Show More
@@ -10,7 +10,7 b' from remoterepo import *' | |||
|
10 | 10 | from i18n import gettext as _ |
|
11 | 11 | from demandload import * |
|
12 | 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 | 15 | class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): |
|
16 | 16 | def __init__(self, ui): |
@@ -192,6 +192,10 b' class httprepository(remoterepository):' | |||
|
192 | 192 | cu = "%s?%s" % (self.url, qs) |
|
193 | 193 | try: |
|
194 | 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 | 199 | except httplib.HTTPException, inst: |
|
196 | 200 | self.ui.debug(_('http error while sending %s command\n') % cmd) |
|
197 | 201 | self.ui.print_exc() |
@@ -278,17 +282,22 b' class httprepository(remoterepository):' | |||
|
278 | 282 | for chunk in util.filechunkiter(cg): |
|
279 | 283 | fp.write(chunk) |
|
280 | 284 | length = fp.tell() |
|
281 | rfp = self.do_cmd( | |
|
282 | 'unbundle', data=fp, | |
|
283 | headers={'content-length': length, | |
|
284 | 'content-type': 'application/octet-stream'}, | |
|
285 | heads=' '.join(map(hex, heads))) | |
|
286 | 285 | try: |
|
287 | ret = int(rfp.readline()) | |
|
288 | self.ui.write(rfp.read()) | |
|
289 | return ret | |
|
290 | finally: | |
|
291 | rfp.close() | |
|
286 | rfp = self.do_cmd( | |
|
287 | 'unbundle', data=fp, | |
|
288 | headers={'content-length': length, | |
|
289 | 'content-type': 'application/octet-stream'}, | |
|
290 | heads=' '.join(map(hex, heads))) | |
|
291 | try: | |
|
292 | ret = int(rfp.readline()) | |
|
293 | self.ui.write(rfp.read()) | |
|
294 | return ret | |
|
295 | finally: | |
|
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 | 301 | finally: |
|
293 | 302 | fp.close() |
|
294 | 303 | os.unlink(tempname) |
General Comments 0
You need to be logged in to leave comments.
Login now