Bug 2654 - revset gives unexpected results on invalid token (no error message)
Summary: revset gives unexpected results on invalid token (no error message)
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-23 10:41 UTC by Greg Ward
Modified: 2012-05-13 04:51 UTC (History)
8 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Ward 2011-02-23 10:41 UTC
A co-worker accidentally used an invalid operator ("AND") in a revset
expression, and wasted 15 minutes trying to understand why he was getting
unexpected results.  From a quick experiment, it appears that revset simply
stops parsing when it hits an invalid token and evaluates the expression up
to that point.

Expected result: abort with a clear error message, e.g. "invalid token: AND".

Example:

  $ hg log -q -r '1 or 2'        # good revset, expected output
  1:273ce12ad8f1
  2:ecf3fd948051

  $ hg log -q -r '1 OR 2'        # bad revset, unexpected output
  1:273ce12ad8f1

The second example should, IMHO, die with "invalid token: OR".
Comment 1 Bernhard Leiner 2011-03-16 16:21 UTC
I have just sent a patch to the mailing list which will trigger an parse
error if a revset is not parsed completely.
Comment 2 Greg Ward 2011-03-16 19:46 UTC
Matt queued the patch: woo hoo.  Thank you bernh!
Comment 3 HG Bot 2011-03-17 12:00 UTC
Fixed by http://selenic.com/repo/hg/rev/e798e430c5e5
Bernhard Leiner <bleiner@gmail.com>
revset: report a parse error if a revset is not parsed completely (issue2654)

(please test the fix)
Comment 4 Matt Mackall 2011-03-17 13:55 UTC
Silly robot.
Comment 5 Greg Ward 2011-03-17 18:22 UTC
...and I just confirmed manually that the fix worked.  So this can stay
resolved.
Comment 6 Matt Mackall 2011-03-18 08:02 UTC
Setting back to resolved.

Every message added while in the resolved state sets the state back to 
chatting. Please please don't respond with "oops, sorry".
Comment 7 Matt Mackall 2011-03-18 08:13 UTC
Oh man.
Comment 8 HG Bot 2011-06-01 16:00 UTC
Fixed by http://selenic.com/repo/hg/rev/ffcb7e4d719f
Bernhard Leiner <bleiner@gmail.com>
revset: report a parse error if a revset is not parsed completely (issue2654)

(please test the fix)
Comment 9 Bugzilla 2012-05-12 09:17 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:17 EDT  ---

This bug was previously known as _bug_ 2654 at http://mercurial.selenic.com/bts/issue2654