not a very informative error message

Cameron Simpson cs at zip.com.au
Sun Aug 9 02:14:48 UTC 2015


On 09Aug2015 12:13, 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
>>
>>Since this isn't a valid revision or revset, all it can tell you is 
>>that the problem occurred at the 13th character.
>>
>>I'm not sure what you are trying to do here.  The '+' on the end of 
>>the revision simply means that the working directory is dirty- it 
>>isn't part of the revision value.
>
>Well, as an outsider, I read Neal's email to indicate that here is a 
>case where hg's error message in unhelpful to the user.
>
>Specificly, I'd read it to indicate that:
>
>(a) the error message, in this context, sucks. "position 13" in what? 
>"not a prefix"? Oh, not a prefix of a revision hash. "end"? Huh?
>
>(b) it is not an unnatural mistake to grab the whole "1f8f96084e75+" 
>word from the output of "hg id". It might be good to recognise this 
>explicitly in hg's revcode parser and suggest to the user that that is 
>what they did.
>
>Regarding (a), when I write error messages and when I read them, this:
>
> not a prefix: end
>
>normally suggests that the literal text "end" is either the whole 
>value being rejected, or the tail of the rejected value (i.e. the 
>parse failed when it reached the string "end" in some larger string).
>
>One, IMO genuine, problem with the error is that it does not even make 
>it clear what hg is unhappy about. The "-r" option? The filename? The 
>spelling of "cat"?  Some context is very needed in this message.

And to be more clear, I don't think Neal is suggesting that "hg" should accept 
"1f8f96084e75+" and work with it, he's suggesting that the error message in no 
way helps the user realise why hg has rejected their command.

Cheers,
Cameron Simpson <cs at zip.com.au>

No real plot, some good special effects, but not enough to save this very
forgettable film. S&N: Windows 95.
        - Phil Herring <revdoc at uow.edu.au> on _Mission Impossible_



More information about the Mercurial mailing list