# HG changeset patch # User David Soria Parra # Date 2011-02-20 23:37:55 # Node ID b3f9af7c22c5241be2eea24140cc6a3c834f9b59 # Parent 8b1125eb361e666627983918908de9a8252c5c7f wireproto: catch possible cast error in pushkey The server can return an unexpected answer like 'ssl required'. We catch those possible cast errors and abort the operation. diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -80,7 +80,12 @@ class wirerepository(repo.repository): key=encoding.fromlocal(key), old=encoding.fromlocal(old), new=encoding.fromlocal(new)) - return bool(int(d)) + try: + d = bool(int(d)) + except ValueError: + raise error.ResponseError( + _('push failed (unexpected response):'), d) + return d def listkeys(self, namespace): if not self.capable('pushkey'):