wireproto: catch possible cast error in pushkey stable
authorDavid Soria Parra <dsp@php.net>
Mon, 21 Feb 2011 00:37:55 +0100
branchstable
changeset 13450 b3f9af7c22c5
parent 13449 8b1125eb361e
child 13452 3d3661df05e5
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.
mercurial/wireproto.py
--- a/mercurial/wireproto.py	Sun Feb 20 18:06:05 2011 +0100
+++ b/mercurial/wireproto.py	Mon Feb 21 00:37:55 2011 +0100
@@ -80,7 +80,12 @@
                        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'):