Mercurial > hg
changeset 7010:9141bebefe3e
enhance the error output in case of failure during http push
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 08 Sep 2008 14:22:14 +0200 |
parents | 3d54cf97598d |
children | 7da76778dbd7 |
files | mercurial/httprepo.py |
diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/httprepo.py Mon Sep 08 14:04:10 2008 +0200 +++ b/mercurial/httprepo.py Mon Sep 08 14:22:14 2008 +0200 @@ -422,16 +422,18 @@ fp = httpsendfile(tempname, "rb") try: try: - rfp = self.do_cmd( - 'unbundle', data=fp, - headers={'Content-Type': 'application/octet-stream'}, - heads=' '.join(map(hex, heads))) + resp = self.do_read( + 'unbundle', data=fp, + headers={'Content-Type': 'application/octet-stream'}, + heads=' '.join(map(hex, heads))) + resp_code, output = resp.split('\n', 1) try: - ret = int(rfp.readline()) - self.ui.write(rfp.read()) - return ret - finally: - rfp.close() + ret = int(resp_code) + except ValueError, err: + raise util.UnexpectedOutput( + _('push failed (unexpected response):'), resp) + self.ui.write(output) + return ret except socket.error, err: if err[0] in (errno.ECONNRESET, errno.EPIPE): raise util.Abort(_('push failed: %s') % err[1])