Mercurial > hg
diff tests/test-revset.t @ 36685:2a258985ffeb
revsetlang: add a hint for more useful parse errors
This logic is largely based on the similar logic added to template error
messages in D2608 and D2609, but with a few tweaks based on how revsets
actually work.
Differential Revision: https://phab.mercurial-scm.org/D2619
author | Ryan McElroy <rmcelroy@fb.com> |
---|---|
date | Sat, 03 Mar 2018 15:31:37 -0800 |
parents | edf736c3c064 |
children | e32dfff71529 |
line wrap: on
line diff
--- a/tests/test-revset.t Sat Mar 03 11:07:46 2018 -0800 +++ b/tests/test-revset.t Sat Mar 03 15:31:37 2018 -0800 @@ -399,6 +399,8 @@ 4 $ log 'date(this is a test)' hg: parse error at 10: unexpected token: symbol + (date(this is a test) + ^ here) [255] $ log 'date()' hg: parse error: date requires a string @@ -408,6 +410,8 @@ [255] $ log 'date(' hg: parse error at 5: not a prefix: end + (date( + ^ here) [255] $ log 'date("\xy")' hg: parse error: invalid \x escape* (glob) @@ -614,18 +618,28 @@ $ hg debugrevspec '[0]' hg: parse error at 0: not a prefix: [ + ([0] + ^ here) [255] $ hg debugrevspec '.#' hg: parse error at 2: not a prefix: end + (.# + ^ here) [255] $ hg debugrevspec '#rel' hg: parse error at 0: not a prefix: # + (#rel + ^ here) [255] $ hg debugrevspec '.#rel[0' hg: parse error at 7: unexpected token: end + (.#rel[0 + ^ here) [255] $ hg debugrevspec '.]' hg: parse error at 1: invalid token + (.] + ^ here) [255] $ hg debugrevspec '.#generations[a]' @@ -1330,6 +1344,8 @@ 6 $ try 'grep(r"\")' hg: parse error at 7: unterminated string + (grep(r"\") + ^ here) [255] $ log 'head()' 0 @@ -2774,3 +2790,14 @@ $ cd .. $ cd repo + +test multiline revset with errors + + $ echo > multiline-revset + $ echo '. +' >> multiline-revset + $ echo '.^ +' >> multiline-revset + $ hg log -r "`cat multiline-revset`" + hg: parse error at 9: not a prefix: end + ( . + .^ + + ^ here) + [255]