Mercurial > public > mercurial-scm > hg
comparison mercurial/revsetlang.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 | d783f945a701 |
children | 18489e26d9a0 |
comparison
equal
deleted
inserted
replaced
45775:5bb900885311 | 45776:0fc8b066928a |
---|---|
640 | 640 |
641 def parse(spec, lookup=None): | 641 def parse(spec, lookup=None): |
642 try: | 642 try: |
643 return _parsewith(spec, lookup=lookup) | 643 return _parsewith(spec, lookup=lookup) |
644 except error.ParseError as inst: | 644 except error.ParseError as inst: |
645 if len(inst.args) > 1: # has location | 645 if inst.location is not None: |
646 loc = inst.args[1] | 646 loc = inst.location |
647 # Remove newlines -- spaces are equivalent whitespace. | 647 # Remove newlines -- spaces are equivalent whitespace. |
648 spec = spec.replace(b'\n', b' ') | 648 spec = spec.replace(b'\n', b' ') |
649 # We want the caret to point to the place in the template that | 649 # We want the caret to point to the place in the template that |
650 # failed to parse, but in a hint we get a open paren at the | 650 # failed to parse, but in a hint we get a open paren at the |
651 # start. Therefore, we print "loc + 1" spaces (instead of "loc") | 651 # start. Therefore, we print "loc + 1" spaces (instead of "loc") |