System.InvalidOperationException: Unable to locate Mercurial version number in 'Mercurial Distributed SCM (version 2.4.2+20130203)'


Mercurial.Net v unable to locate version of Mercurial (version 2.4.2+20130203)

Call stack leads to Client.GetVersion() method, with Regex @"\(version\s+(?<version>[0-9.]+)(\+\d+-[a-f0-9]+)?\)" It works fine, if I recompile with "(version\s+(?<version>[0-9.]+)(+\d+(-[a-f0-9])*)?)"


lassevk wrote Feb 18, 2013 at 4:38 PM

Will be handled in a future version of Mercurial.Net.

Unfortunately it has fallen a bit by the wayside for me, but I'm picking up development again these days so hopefully it won't be long until I can release an updated version of the library.

I'll make sure to fix that bug. I'm pretty sure I have fixed a similar case before, but perhaps not in the format of a date.

Togakangaroo wrote Apr 3, 2013 at 3:23 PM

Any news on this?

sonjz wrote Aug 21, 2014 at 7:38 PM

I had the same issue as @andreyshavelev, just providing some more detailed notes on the patch.

1) In my project that is using Mercurial.NET, I removed Mercurial.NET via nuget Package Manager Console, "uninstall-package Mercurial.NET"

2) Downloaded latest source https://mercurialnet.codeplex.com/SourceControl/latest# and unzipped to MY_WORKING_PATH/packages-src

3) In my project, I make a new Reference to the Mercurial.NET project.

4) Updated the following src files with the following line:
ClientExecutable.cs : line 217
Gui\GuiClient.cs : line 159 (not sure if this one is necessary.
var re = new Regex(@"\(version\s+(?<version>[0-9.]+)(\+\d+(-[a-f0-9])*)?\)", RegexOptions.IgnoreCase);
5) Clean solution recompile.