##// END OF EJS Templates
error: move UnexpectedOutput (now ResponseError)
Matt Mackall -
r7641:d2f75383 default
parent child Browse files
Show More
@@ -111,7 +111,7 b' def _runcatch(ui, args):'
111 111 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
112 112 else:
113 113 ui.warn(_("abort: %s\n") % inst.strerror)
114 except util.UnexpectedOutput, inst:
114 except error.ResponseError, inst:
115 115 ui.warn(_("abort: %s") % inst.args[0])
116 116 if not isinstance(inst.args[1], basestring):
117 117 ui.warn(" %r\n" % (inst.args[1],))
@@ -46,3 +46,7 b' class LockHeld(LockError):'
46 46
47 47 class LockUnavailable(LockError):
48 48 pass
49
50 class ResponseError(Exception):
51 """Raised to print an error with part of output and exit."""
52
@@ -135,7 +135,7 b' class httprepository(repo.repository):'
135 135 try:
136 136 return map(bin, d[:-1].split(" "))
137 137 except:
138 raise util.UnexpectedOutput(_("unexpected response:"), d)
138 raise error.ResponseError(_("unexpected response:"), d)
139 139
140 140 def branches(self, nodes):
141 141 n = " ".join(map(hex, nodes))
@@ -144,7 +144,7 b' class httprepository(repo.repository):'
144 144 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
145 145 return br
146 146 except:
147 raise util.UnexpectedOutput(_("unexpected response:"), d)
147 raise error.ResponseError(_("unexpected response:"), d)
148 148
149 149 def between(self, pairs):
150 150 batch = 8 # avoid giant requests
@@ -155,7 +155,7 b' class httprepository(repo.repository):'
155 155 try:
156 156 r += [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
157 157 except:
158 raise util.UnexpectedOutput(_("unexpected response:"), d)
158 raise error.ResponseError(_("unexpected response:"), d)
159 159 return r
160 160
161 161 def changegroup(self, nodes, kind):
@@ -200,7 +200,7 b' class httprepository(repo.repository):'
200 200 try:
201 201 ret = int(resp_code)
202 202 except ValueError, err:
203 raise util.UnexpectedOutput(
203 raise error.ResponseError(
204 204 _('push failed (unexpected response):'), resp)
205 205 self.ui.write(output)
206 206 return ret
@@ -2076,7 +2076,7 b' class localrepository(repo.repository):'
2076 2076 try:
2077 2077 resp = int(l)
2078 2078 except ValueError:
2079 raise util.UnexpectedOutput(
2079 raise error.ResponseError(
2080 2080 _('Unexpected response from remote server:'), l)
2081 2081 if resp == 1:
2082 2082 raise util.Abort(_('operation forbidden by server'))
@@ -2089,7 +2089,7 b' class localrepository(repo.repository):'
2089 2089 try:
2090 2090 total_files, total_bytes = map(int, l.split(' ', 1))
2091 2091 except (ValueError, TypeError):
2092 raise util.UnexpectedOutput(
2092 raise error.ResponseError(
2093 2093 _('Unexpected response from remote server:'), l)
2094 2094 self.ui.status(_('%d files to transfer, %s of data\n') %
2095 2095 (total_files, util.bytecount(total_bytes)))
@@ -2101,7 +2101,7 b' class localrepository(repo.repository):'
2101 2101 name, size = l.split('\0', 1)
2102 2102 size = int(size)
2103 2103 except (ValueError, TypeError):
2104 raise util.UnexpectedOutput(
2104 raise error.ResponseError(
2105 2105 _('Unexpected response from remote server:'), l)
2106 2106 self.ui.debug(_('adding %s (%s)\n') % (name, util.bytecount(size)))
2107 2107 ofp = self.sopener(name, 'w')
@@ -132,7 +132,7 b' class sshrepository(repo.repository):'
132 132 try:
133 133 l = int(l)
134 134 except:
135 self.raise_(util.UnexpectedOutput(_("unexpected response:"), l))
135 self.raise_(error.ResponseError(_("unexpected response:"), l))
136 136 return self.pipei.read(l)
137 137
138 138 def _send(self, data, flush=False):
@@ -164,7 +164,7 b' class sshrepository(repo.repository):'
164 164 try:
165 165 return map(bin, d[:-1].split(" "))
166 166 except:
167 self.raise_(util.UnexpectedOutput(_("unexpected response:"), d))
167 self.raise_(error.ResponseError(_("unexpected response:"), d))
168 168
169 169 def branches(self, nodes):
170 170 n = " ".join(map(hex, nodes))
@@ -173,7 +173,7 b' class sshrepository(repo.repository):'
173 173 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
174 174 return br
175 175 except:
176 self.raise_(util.UnexpectedOutput(_("unexpected response:"), d))
176 self.raise_(error.ResponseError(_("unexpected response:"), d))
177 177
178 178 def between(self, pairs):
179 179 n = " ".join(["-".join(map(hex, p)) for p in pairs])
@@ -182,7 +182,7 b' class sshrepository(repo.repository):'
182 182 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
183 183 return p
184 184 except:
185 self.raise_(util.UnexpectedOutput(_("unexpected response:"), d))
185 self.raise_(error.ResponseError(_("unexpected response:"), d))
186 186
187 187 def changegroup(self, nodes, kind):
188 188 n = " ".join(map(hex, nodes))
@@ -217,7 +217,7 b' class sshrepository(repo.repository):'
217 217 try:
218 218 return int(r)
219 219 except:
220 self.raise_(util.UnexpectedOutput(_("unexpected response:"), r))
220 self.raise_(error.ResponseError(_("unexpected response:"), r))
221 221
222 222 def addchangegroup(self, cg, source, url):
223 223 d = self.call("addchangegroup")
@@ -239,7 +239,7 b' class sshrepository(repo.repository):'
239 239 try:
240 240 return int(r)
241 241 except:
242 self.raise_(util.UnexpectedOutput(_("unexpected response:"), r))
242 self.raise_(error.ResponseError(_("unexpected response:"), r))
243 243
244 244 def stream_out(self):
245 245 return self.do_cmd('stream_out')
@@ -335,9 +335,6 b' def increasingchunks(source, min=1024, m'
335 335 class Abort(Exception):
336 336 """Raised if a command needs to print an error and exit."""
337 337
338 class UnexpectedOutput(Abort):
339 """Raised to print an error with part of output and exit."""
340
341 338 def always(fn): return True
342 339 def never(fn): return False
343 340
General Comments 0
You need to be logged in to leave comments. Login now