not a very informative error message

Yuya Nishihara yuya at tcha.org
Sun Aug 9 08:25:38 UTC 2015


On Sat, 08 Aug 2015 22:58:23 -0400, Matt Harbison wrote:
> On Sat, 08 Aug 2015 22:13:04 -0400, Cameron Simpson <cs at zip.com.au> wrote:
> > On 08Aug2015 21:11, Matt Harbison <mharbison72 at gmail.com> wrote:
> >> On Fri, 07 Aug 2015 07:19:38 -0400, Neal Becker <ndbecker2 at gmail.com>  
> >> wrote:
> >>
> >>> $ hg id
> >>> 1f8f96084e75+ (collision) tip
> >>>
> >>> $ hg cat -r 1f8f96084e75+ test_awgn.py > /dev/null
> >>              01234567890123
> >>
> >>> hg: parse error at 13: not a prefix: end

> I pretty much agree that it isn't helpful, but it looks like the same  
> parser code is used for revsets, filesets and templates.  Therefore it  
> really can't know about common mistakes specific to one of these in order  
> to make suggestions.  It's just parsing based on language tokens it has  
> been told about for which ever module is using it, and bails when it gets  
> confused.  I'm not sure if this part can be made better.
> 
> That said, it would be nice if it would say that the revision arg is bad.   
> Debugging a command that used a revision, files and a template would be a  
> headache.  I wonder if we can catch the parse error and prefix the message  
> with 'revision:' or whatever.  Bad commands are caught and offer a  
> suggestion if you misspell cat, for example.  I'm not sure what would  
> happen if multiple --rev args are given, but we would be no worse off I  
> guess.

Maybe a ParseError could have more verbose output:

  % hg log -r 1f8f96084e75+
  hg: parse error at 13: not a prefix: end
  1f8f96084e75+
              ~^



More information about the Mercurial mailing list