ParseError: ('not a prefix: end', 41)

Mads Kiilerich mads at kiilerich.com
Sun Jun 19 08:53:50 CDT 2011


Angel Ezquerra wrote, On 06/13/2011 09:11 AM:
> A user has recently reported the following traceback happening while
> running the latest stable version of TortoiseHg:
>
> ** Mercurial version (1.8.4).  TortoiseHg version (2.0.5)
> ** Command: --nofork workbench
> ** CWD: C:\mais\xx_Data_\DataControl
> ** Extensions loaded: fixfrozenexts, hgk, highlight, fetch
> ** Python version: 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC
> v.1500 32 bit (Intel)]
> ** Windows version: (6, 1, 7601, 2, 'Service Pack 1')
> ** Processor architecture: x86
> ** Qt-4.7.1 PyQt-4.8.3
> Recoverable runtime error (stderr):
> Traceback (most recent call last):
>    File "tortoisehg\hgqt\revdetails.pyo", line 221, in onFileRevSelected
>    File "tortoisehg\hgqt\fileview.pyo", line 306, in displayFile
>    File "tortoisehg\hgqt\fileview.pyo", line 529, in __init__
>    File "tortoisehg\hgqt\fileview.pyo", line 714, in readStatus
>    File "tortoisehg\hgqt\fileview.pyo", line 668, in
> genSubrepoRevChangedDescription
>    File "mercurial\commands.pyo", line 2671, in log
>    File "mercurial\cmdutil.pyo", line 1119, in walkchangerevs
>    File "mercurial\cmdutil.pyo", line 177, in revrange
>    File "mercurial\revset.pyo", line 813, in match
>    File "mercurial\parser.pyo", line 81, in parse
>    File "mercurial\parser.pyo", line 73, in _parse
>    File "mercurial\parser.pyo", line 45, in _parse
> ParseError: ('not a prefix: end', 41)
>
> I am trying to debug the problem but I am a bit stuck.
>
> The problem happens on a part of the code that is trying to get the
> subrepo information in order show it to the user. The tortoisehg code
> in question is simply calling:
>
> commands.log(_ui, srepo, **opts)
>
> where srepo is the subrepository repo object, and opts is a dictionary
> with the following fields:
>
> opts = {'date':None, 'user':None, 'rev':[sto]}
>
> "sto" is a string that contains the node id of the revision whose
> information we want to get.
>
> Looking at the parser code I don't really understand how we can get
> that error. I've tried feeding the commands.log() call with invalid
> data but I have not been able to reproduce the error. Any clues
> regarding this issue would be appreciated.

This error is reported when trying to parse a revset spec that ends with 
an infix operator (such as "+"), without any second parameter.

In this case I guess the subrepo revision somehow ended up with a hash 
followed by a trailing "+" (which usually indicates a repo with 
uncommitted changes). IIRC there was a bug that made that possible, so 
there might be repos out there with .hgsubstate like this.

TortoiseHg handles this exception in other places but didn't expect it 
to happen here. Perhaps it should handle such a ParseError like it 
handles RepoLookupError.

/Mads



More information about the Mercurial-devel mailing list