--- a/mercurial/dispatch.py Mon Jan 12 11:09:14 2009 -0600
+++ b/mercurial/dispatch.py Mon Jan 12 11:28:28 2009 -0600
@@ -111,7 +111,7 @@
ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
else:
ui.warn(_("abort: %s\n") % inst.strerror)
- except util.UnexpectedOutput, inst:
+ except error.ResponseError, inst:
ui.warn(_("abort: %s") % inst.args[0])
if not isinstance(inst.args[1], basestring):
ui.warn(" %r\n" % (inst.args[1],))
--- a/mercurial/error.py Mon Jan 12 11:09:14 2009 -0600
+++ b/mercurial/error.py Mon Jan 12 11:28:28 2009 -0600
@@ -46,3 +46,7 @@
class LockUnavailable(LockError):
pass
+
+class ResponseError(Exception):
+ """Raised to print an error with part of output and exit."""
+
--- a/mercurial/httprepo.py Mon Jan 12 11:09:14 2009 -0600
+++ b/mercurial/httprepo.py Mon Jan 12 11:28:28 2009 -0600
@@ -135,7 +135,7 @@
try:
return map(bin, d[:-1].split(" "))
except:
- raise util.UnexpectedOutput(_("unexpected response:"), d)
+ raise error.ResponseError(_("unexpected response:"), d)
def branches(self, nodes):
n = " ".join(map(hex, nodes))
@@ -144,7 +144,7 @@
br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
return br
except:
- raise util.UnexpectedOutput(_("unexpected response:"), d)
+ raise error.ResponseError(_("unexpected response:"), d)
def between(self, pairs):
batch = 8 # avoid giant requests
@@ -155,7 +155,7 @@
try:
r += [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
except:
- raise util.UnexpectedOutput(_("unexpected response:"), d)
+ raise error.ResponseError(_("unexpected response:"), d)
return r
def changegroup(self, nodes, kind):
@@ -200,7 +200,7 @@
try:
ret = int(resp_code)
except ValueError, err:
- raise util.UnexpectedOutput(
+ raise error.ResponseError(
_('push failed (unexpected response):'), resp)
self.ui.write(output)
return ret
--- a/mercurial/localrepo.py Mon Jan 12 11:09:14 2009 -0600
+++ b/mercurial/localrepo.py Mon Jan 12 11:28:28 2009 -0600
@@ -2076,7 +2076,7 @@
try:
resp = int(l)
except ValueError:
- raise util.UnexpectedOutput(
+ raise error.ResponseError(
_('Unexpected response from remote server:'), l)
if resp == 1:
raise util.Abort(_('operation forbidden by server'))
@@ -2089,7 +2089,7 @@
try:
total_files, total_bytes = map(int, l.split(' ', 1))
except (ValueError, TypeError):
- raise util.UnexpectedOutput(
+ raise error.ResponseError(
_('Unexpected response from remote server:'), l)
self.ui.status(_('%d files to transfer, %s of data\n') %
(total_files, util.bytecount(total_bytes)))
@@ -2101,7 +2101,7 @@
name, size = l.split('\0', 1)
size = int(size)
except (ValueError, TypeError):
- raise util.UnexpectedOutput(
+ raise error.ResponseError(
_('Unexpected response from remote server:'), l)
self.ui.debug(_('adding %s (%s)\n') % (name, util.bytecount(size)))
ofp = self.sopener(name, 'w')
--- a/mercurial/sshrepo.py Mon Jan 12 11:09:14 2009 -0600
+++ b/mercurial/sshrepo.py Mon Jan 12 11:28:28 2009 -0600
@@ -132,7 +132,7 @@
try:
l = int(l)
except:
- self.raise_(util.UnexpectedOutput(_("unexpected response:"), l))
+ self.raise_(error.ResponseError(_("unexpected response:"), l))
return self.pipei.read(l)
def _send(self, data, flush=False):
@@ -164,7 +164,7 @@
try:
return map(bin, d[:-1].split(" "))
except:
- self.raise_(util.UnexpectedOutput(_("unexpected response:"), d))
+ self.raise_(error.ResponseError(_("unexpected response:"), d))
def branches(self, nodes):
n = " ".join(map(hex, nodes))
@@ -173,7 +173,7 @@
br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
return br
except:
- self.raise_(util.UnexpectedOutput(_("unexpected response:"), d))
+ self.raise_(error.ResponseError(_("unexpected response:"), d))
def between(self, pairs):
n = " ".join(["-".join(map(hex, p)) for p in pairs])
@@ -182,7 +182,7 @@
p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
return p
except:
- self.raise_(util.UnexpectedOutput(_("unexpected response:"), d))
+ self.raise_(error.ResponseError(_("unexpected response:"), d))
def changegroup(self, nodes, kind):
n = " ".join(map(hex, nodes))
@@ -217,7 +217,7 @@
try:
return int(r)
except:
- self.raise_(util.UnexpectedOutput(_("unexpected response:"), r))
+ self.raise_(error.ResponseError(_("unexpected response:"), r))
def addchangegroup(self, cg, source, url):
d = self.call("addchangegroup")
@@ -239,7 +239,7 @@
try:
return int(r)
except:
- self.raise_(util.UnexpectedOutput(_("unexpected response:"), r))
+ self.raise_(error.ResponseError(_("unexpected response:"), r))
def stream_out(self):
return self.do_cmd('stream_out')
--- a/mercurial/util.py Mon Jan 12 11:09:14 2009 -0600
+++ b/mercurial/util.py Mon Jan 12 11:28:28 2009 -0600
@@ -335,9 +335,6 @@
class Abort(Exception):
"""Raised if a command needs to print an error and exit."""
-class UnexpectedOutput(Abort):
- """Raised to print an error with part of output and exit."""
-
def always(fn): return True
def never(fn): return False