[PATCH] wireproto: catch possible cast error in pushkey
David Soria Parra
dsp at php.net
Sun Feb 20 17:51:50 CST 2011
# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1298245075 -3600
# Node ID b2e4e394d742ca3a948848dc2aa9d288c0eaa861
# Parent 643b8212813e631b5525049fc4321a34a4def105
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 -r 643b8212813e -r b2e4e394d742 mercurial/wireproto.py
--- a/mercurial/wireproto.py Wed Feb 16 15:02:30 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'):
More information about the Mercurial-devel
mailing list