Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 45776:0fc8b066928a
errors: name arguments to ParseError constructor
As with similar previous patches, this is to improve readability.
Differential Revision: https://phab.mercurial-scm.org/D9240
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 22 Oct 2020 09:58:05 -0700 |
parents | d2e1dcd4490d |
children | 0883413e09bc |
comparison
equal
deleted
inserted
replaced
45775:5bb900885311 | 45776:0fc8b066928a |
---|---|
241 def _formatparse(write, inst): | 241 def _formatparse(write, inst): |
242 similar = [] | 242 similar = [] |
243 if isinstance(inst, error.UnknownIdentifier): | 243 if isinstance(inst, error.UnknownIdentifier): |
244 # make sure to check fileset first, as revset can invoke fileset | 244 # make sure to check fileset first, as revset can invoke fileset |
245 similar = _getsimilar(inst.symbols, inst.function) | 245 similar = _getsimilar(inst.symbols, inst.function) |
246 if len(inst.args) > 1: | 246 if inst.location is not None: |
247 write( | 247 write( |
248 _(b"hg: parse error at %s: %s\n") | 248 _(b"hg: parse error at %s: %s\n") |
249 % (pycompat.bytestr(inst.args[1]), inst.args[0]) | 249 % (pycompat.bytestr(inst.location), inst.message) |
250 ) | 250 ) |
251 if inst.args[0].startswith(b' '): | 251 if inst.message.startswith(b' '): |
252 write(_(b"unexpected leading whitespace\n")) | 252 write(_(b"unexpected leading whitespace\n")) |
253 else: | 253 else: |
254 write(_(b"hg: parse error: %s\n") % inst.args[0]) | 254 write(_(b"hg: parse error: %s\n") % inst.message) |
255 _reportsimilar(write, similar) | 255 _reportsimilar(write, similar) |
256 if inst.hint: | 256 if inst.hint: |
257 write(_(b"(%s)\n") % inst.hint) | 257 write(_(b"(%s)\n") % inst.hint) |
258 | 258 |
259 | 259 |