Show More
@@ -117,6 +117,7 b' except ImportError:' | |||
|
117 | 117 | 'formatvariant.config.default': 'green', |
|
118 | 118 | 'formatvariant.default': '', |
|
119 | 119 | 'histedit.remaining': 'red bold', |
|
120 | 'ui.error': 'red', | |
|
120 | 121 | 'ui.prompt': 'yellow', |
|
121 | 122 | 'log.changeset': 'yellow', |
|
122 | 123 | 'patchbomb.finalsummary': '', |
@@ -353,7 +353,7 b' def _serverequest(ui, repo, conn, create' | |||
|
353 | 353 | # handle exceptions that may be raised by command server. most of |
|
354 | 354 | # known exceptions are caught by dispatch. |
|
355 | 355 | except error.Abort as inst: |
|
356 |
ui. |
|
|
356 | ui.error(_('abort: %s\n') % inst) | |
|
357 | 357 | except IOError as inst: |
|
358 | 358 | if inst.errno != errno.EPIPE: |
|
359 | 359 | raise |
@@ -212,9 +212,9 b' def dispatch(req):' | |||
|
212 | 212 | try: |
|
213 | 213 | ret = _runcatch(req) or 0 |
|
214 | 214 | except error.ProgrammingError as inst: |
|
215 |
req.ui. |
|
|
215 | req.ui.error(_('** ProgrammingError: %s\n') % inst) | |
|
216 | 216 | if inst.hint: |
|
217 |
req.ui. |
|
|
217 | req.ui.error(_('** (%s)\n') % inst.hint) | |
|
218 | 218 | raise |
|
219 | 219 | except KeyboardInterrupt as inst: |
|
220 | 220 | try: |
@@ -222,7 +222,7 b' def dispatch(req):' | |||
|
222 | 222 | msg = _("killed!\n") |
|
223 | 223 | else: |
|
224 | 224 | msg = _("interrupted!\n") |
|
225 |
req.ui. |
|
|
225 | req.ui.error(msg) | |
|
226 | 226 | except error.SignalInterrupt: |
|
227 | 227 | # maybe pager would quit without consuming all the output, and |
|
228 | 228 | # SIGPIPE was raised. we cannot print anything in this case. |
@@ -169,64 +169,64 b' def callcatch(ui, func):' | |||
|
169 | 169 | reason = _('timed out waiting for lock held by %r') % inst.locker |
|
170 | 170 | else: |
|
171 | 171 | reason = _('lock held by %r') % inst.locker |
|
172 |
ui. |
|
|
173 |
|
|
|
172 | ui.error(_("abort: %s: %s\n") % ( | |
|
173 | inst.desc or stringutil.forcebytestr(inst.filename), reason)) | |
|
174 | 174 | if not inst.locker: |
|
175 |
ui. |
|
|
175 | ui.error(_("(lock might be very busy)\n")) | |
|
176 | 176 | except error.LockUnavailable as inst: |
|
177 |
ui. |
|
|
178 | (inst.desc or stringutil.forcebytestr(inst.filename), | |
|
179 | encoding.strtolocal(inst.strerror))) | |
|
177 | ui.error(_("abort: could not lock %s: %s\n") % | |
|
178 | (inst.desc or stringutil.forcebytestr(inst.filename), | |
|
179 | encoding.strtolocal(inst.strerror))) | |
|
180 | 180 | except error.OutOfBandError as inst: |
|
181 | 181 | if inst.args: |
|
182 | 182 | msg = _("abort: remote error:\n") |
|
183 | 183 | else: |
|
184 | 184 | msg = _("abort: remote error\n") |
|
185 |
ui. |
|
|
185 | ui.error(msg) | |
|
186 | 186 | if inst.args: |
|
187 |
ui. |
|
|
187 | ui.error(''.join(inst.args)) | |
|
188 | 188 | if inst.hint: |
|
189 |
ui. |
|
|
189 | ui.error('(%s)\n' % inst.hint) | |
|
190 | 190 | except error.RepoError as inst: |
|
191 |
ui. |
|
|
191 | ui.error(_("abort: %s!\n") % inst) | |
|
192 | 192 | if inst.hint: |
|
193 |
ui. |
|
|
193 | ui.error(_("(%s)\n") % inst.hint) | |
|
194 | 194 | except error.ResponseError as inst: |
|
195 |
ui. |
|
|
195 | ui.error(_("abort: %s") % inst.args[0]) | |
|
196 | 196 | msg = inst.args[1] |
|
197 | 197 | if isinstance(msg, type(u'')): |
|
198 | 198 | msg = pycompat.sysbytes(msg) |
|
199 | 199 | if not isinstance(msg, bytes): |
|
200 |
ui. |
|
|
200 | ui.error(" %r\n" % (msg,)) | |
|
201 | 201 | elif not msg: |
|
202 |
ui. |
|
|
202 | ui.error(_(" empty string\n")) | |
|
203 | 203 | else: |
|
204 |
ui. |
|
|
204 | ui.error("\n%r\n" % pycompat.bytestr(stringutil.ellipsis(msg))) | |
|
205 | 205 | except error.CensoredNodeError as inst: |
|
206 |
ui. |
|
|
206 | ui.error(_("abort: file censored %s!\n") % inst) | |
|
207 | 207 | except error.RevlogError as inst: |
|
208 |
ui. |
|
|
208 | ui.error(_("abort: %s!\n") % inst) | |
|
209 | 209 | except error.InterventionRequired as inst: |
|
210 |
ui. |
|
|
210 | ui.error("%s\n" % inst) | |
|
211 | 211 | if inst.hint: |
|
212 |
ui. |
|
|
212 | ui.error(_("(%s)\n") % inst.hint) | |
|
213 | 213 | return 1 |
|
214 | 214 | except error.WdirUnsupported: |
|
215 |
ui. |
|
|
215 | ui.error(_("abort: working directory revision cannot be specified\n")) | |
|
216 | 216 | except error.Abort as inst: |
|
217 |
ui. |
|
|
217 | ui.error(_("abort: %s\n") % inst) | |
|
218 | 218 | if inst.hint: |
|
219 |
ui. |
|
|
219 | ui.error(_("(%s)\n") % inst.hint) | |
|
220 | 220 | except ImportError as inst: |
|
221 |
ui. |
|
|
221 | ui.error(_("abort: %s!\n") % stringutil.forcebytestr(inst)) | |
|
222 | 222 | m = stringutil.forcebytestr(inst).split()[-1] |
|
223 | 223 | if m in "mpatch bdiff".split(): |
|
224 |
ui. |
|
|
224 | ui.error(_("(did you forget to compile extensions?)\n")) | |
|
225 | 225 | elif m in "zlib".split(): |
|
226 |
ui. |
|
|
226 | ui.error(_("(is your Python install correct?)\n")) | |
|
227 | 227 | except IOError as inst: |
|
228 | 228 | if util.safehasattr(inst, "code"): |
|
229 |
ui. |
|
|
229 | ui.error(_("abort: %s\n") % stringutil.forcebytestr(inst)) | |
|
230 | 230 | elif util.safehasattr(inst, "reason"): |
|
231 | 231 | try: # usually it is in the form (errno, strerror) |
|
232 | 232 | reason = inst.reason.args[1] |
@@ -236,34 +236,34 b' def callcatch(ui, func):' | |||
|
236 | 236 | if isinstance(reason, pycompat.unicode): |
|
237 | 237 | # SSLError of Python 2.7.9 contains a unicode |
|
238 | 238 | reason = encoding.unitolocal(reason) |
|
239 |
ui. |
|
|
239 | ui.error(_("abort: error: %s\n") % reason) | |
|
240 | 240 | elif (util.safehasattr(inst, "args") |
|
241 | 241 | and inst.args and inst.args[0] == errno.EPIPE): |
|
242 | 242 | pass |
|
243 | 243 | elif getattr(inst, "strerror", None): |
|
244 | 244 | if getattr(inst, "filename", None): |
|
245 |
ui. |
|
|
245 | ui.error(_("abort: %s: %s\n") % ( | |
|
246 | 246 | encoding.strtolocal(inst.strerror), |
|
247 | 247 | stringutil.forcebytestr(inst.filename))) |
|
248 | 248 | else: |
|
249 |
ui. |
|
|
249 | ui.error(_("abort: %s\n") % encoding.strtolocal(inst.strerror)) | |
|
250 | 250 | else: |
|
251 | 251 | raise |
|
252 | 252 | except OSError as inst: |
|
253 | 253 | if getattr(inst, "filename", None) is not None: |
|
254 |
ui. |
|
|
254 | ui.error(_("abort: %s: '%s'\n") % ( | |
|
255 | 255 | encoding.strtolocal(inst.strerror), |
|
256 | 256 | stringutil.forcebytestr(inst.filename))) |
|
257 | 257 | else: |
|
258 |
ui. |
|
|
258 | ui.error(_("abort: %s\n") % encoding.strtolocal(inst.strerror)) | |
|
259 | 259 | except MemoryError: |
|
260 |
ui. |
|
|
260 | ui.error(_("abort: out of memory\n")) | |
|
261 | 261 | except SystemExit as inst: |
|
262 | 262 | # Commands shouldn't sys.exit directly, but give a return code. |
|
263 | 263 | # Just in case catch this and and pass exit code to caller. |
|
264 | 264 | return inst.code |
|
265 | 265 | except socket.error as inst: |
|
266 |
ui. |
|
|
266 | ui.error(_("abort: %s\n") % stringutil.forcebytestr(inst.args[-1])) | |
|
267 | 267 | |
|
268 | 268 | return -1 |
|
269 | 269 |
@@ -1420,6 +1420,7 b' class ui(object):' | |||
|
1420 | 1420 | return getpass.getpass('') |
|
1421 | 1421 | except EOFError: |
|
1422 | 1422 | raise error.ResponseExpected() |
|
1423 | ||
|
1423 | 1424 | def status(self, *msg, **opts): |
|
1424 | 1425 | '''write status message to output (if ui.quiet is False) |
|
1425 | 1426 | |
@@ -1428,6 +1429,7 b' class ui(object):' | |||
|
1428 | 1429 | if not self.quiet: |
|
1429 | 1430 | opts[r'label'] = opts.get(r'label', '') + ' ui.status' |
|
1430 | 1431 | self.write(*msg, **opts) |
|
1432 | ||
|
1431 | 1433 | def warn(self, *msg, **opts): |
|
1432 | 1434 | '''write warning message to output (stderr) |
|
1433 | 1435 | |
@@ -1435,6 +1437,15 b' class ui(object):' | |||
|
1435 | 1437 | ''' |
|
1436 | 1438 | opts[r'label'] = opts.get(r'label', '') + ' ui.warning' |
|
1437 | 1439 | self.write_err(*msg, **opts) |
|
1440 | ||
|
1441 | def error(self, *msg, **opts): | |
|
1442 | '''write error message to output (stderr) | |
|
1443 | ||
|
1444 | This adds an output label of "ui.error". | |
|
1445 | ''' | |
|
1446 | opts[r'label'] = opts.get(r'label', '') + ' ui.error' | |
|
1447 | self.write_err(*msg, **opts) | |
|
1448 | ||
|
1438 | 1449 | def note(self, *msg, **opts): |
|
1439 | 1450 | '''write note to output (if ui.verbose is True) |
|
1440 | 1451 | |
@@ -1443,6 +1454,7 b' class ui(object):' | |||
|
1443 | 1454 | if self.verbose: |
|
1444 | 1455 | opts[r'label'] = opts.get(r'label', '') + ' ui.note' |
|
1445 | 1456 | self.write(*msg, **opts) |
|
1457 | ||
|
1446 | 1458 | def debug(self, *msg, **opts): |
|
1447 | 1459 | '''write debug message to output (if ui.debugflag is True) |
|
1448 | 1460 |
General Comments 0
You need to be logged in to leave comments.
Login now