equal
deleted
inserted
replaced
9 from __future__ import annotations |
9 from __future__ import annotations |
10 |
10 |
11 import errno |
11 import errno |
12 import io |
12 import io |
13 import os |
13 import os |
14 import socket |
|
15 import struct |
14 import struct |
16 import typing |
15 import typing |
17 |
16 |
18 from concurrent import futures |
17 from concurrent import futures |
19 from .i18n import _ |
18 from .i18n import _ |
301 ui.debug( |
300 ui.debug( |
302 b'http error requesting %s\n' |
301 b'http error requesting %s\n' |
303 % urlutil.hidepassword(req.get_full_url()) |
302 % urlutil.hidepassword(req.get_full_url()) |
304 ) |
303 ) |
305 ui.traceback() |
304 ui.traceback() |
306 raise IOError(None, inst) |
305 raise OSError(None, inst) |
307 finally: |
306 finally: |
308 if ui.debugflag and ui.configbool(b'devel', b'debug.peer-request'): |
307 if ui.debugflag and ui.configbool(b'devel', b'debug.peer-request'): |
309 code = res.code if res else -1 |
308 code = res.code if res else -1 |
310 dbg( |
309 dbg( |
311 line |
310 line |
520 except urlerr.httperror: |
519 except urlerr.httperror: |
521 # Catch and re-raise these so we don't try and treat them |
520 # Catch and re-raise these so we don't try and treat them |
522 # like generic socket errors. They lack any values in |
521 # like generic socket errors. They lack any values in |
523 # .args on Python 3 which breaks our socket.error block. |
522 # .args on Python 3 which breaks our socket.error block. |
524 raise |
523 raise |
525 except socket.error as err: |
524 except OSError as err: |
526 if err.args[0] in (errno.ECONNRESET, errno.EPIPE): |
525 if err.args[0] in (errno.ECONNRESET, errno.EPIPE): |
527 raise error.Abort(_(b'push failed: %s') % err.args[1]) |
526 raise error.Abort(_(b'push failed: %s') % err.args[1]) |
528 raise error.Abort(err.args[1]) |
527 raise error.Abort(err.args[1]) |
529 finally: |
528 finally: |
530 fp.close() |
529 fp.close() |