changeset 13450:b3f9af7c22c5 stable

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.
author David Soria Parra <dsp@php.net>
date Mon, 21 Feb 2011 00:37:55 +0100
parents 8b1125eb361e
children 3d3661df05e5
files mercurial/wireproto.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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'):