changeset 24708:fb47816e1a9c

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.
author Ryan McElroy <rmcelroy@fb.com>
date Mon, 13 Apr 2015 20:53:05 -0700
parents 57f58f96f850
children 69154e0ae384
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Apr 13 21:06:21 2015 -0700
+++ b/mercurial/revset.py	Mon Apr 13 20:53:05 2015 -0700
@@ -241,7 +241,8 @@
                 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)
 
--- a/tests/test-revset.t	Mon Apr 13 21:06:21 2015 -0700
+++ b/tests/test-revset.t	Mon Apr 13 20:53:05 2015 -0700
@@ -1535,7 +1535,7 @@
 
 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 ..