# HG changeset patch # User Ryan McElroy # Date 2015-04-14 03:53:05 # Node ID fb47816e1a9ccd6f48475ac5546021994a2fe8eb # Parent 57f58f96f8508ec913b78b79980711fa5524681a revsets: more informative syntax error message I came across a case where an internal command was using a revset that I didn't immediately pass in and it was difficult to debug what was going wrong with the revset. This prints out the revset and informs the user that the error is with a rebset so it should be more obvious what and where the error is. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -241,7 +241,8 @@ def tokenize(program, lookup=None, symin yield ('symbol', sym, s) pos -= 1 else: - raise error.ParseError(_("syntax error"), pos) + raise error.ParseError(_("syntax error in revset '%s'") % + program, pos) pos += 1 yield ('end', None, pos) diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -1535,7 +1535,7 @@ test in problematic encoding test error message of bad revset $ hg log -r 'foo\\' - hg: parse error at 3: syntax error + hg: parse error at 3: syntax error in revset 'foo\\' [255] $ cd ..