The Mercurial command line client could not be located

Nov 14, 2013 at 11:45 AM
The above exception appears only when a Repository object gets constucted in multi-threaded code.

var repo = new Repository(path); // Must not be constructed in multi threaded code.

Not a big issue but I thought to post it here.
Great work! :)
Nov 14, 2013 at 12:02 PM
Edited Nov 14, 2013 at 12:03 PM
I think you must add some more examples.
Here are some:


Add & commit (multithreaded):

// var file = @"C:\Users\fd\Documents\Visual Studio 2010\Projects\RabbitMQ\RabbitMQ.Client.xml";
// var path = @"C:\Users\fd\Documents\Visual Studio 2010\Projects\RabbitMQ\Repo\";
//
// var repo = new Repository(path); // Must not be constructed in multi threaded code.
// //repo.Init(); // Only if repo doesn't exist.
//
// Parallel.For(0, 100, (Action<int>)delegate(int i)
// {
// var a = new AddCommand();
// string file2 = System.IO.Path.Combine(path, "File_" + i.ToString(CultureInfo.InvariantCulture));
// File.Copy(file, file2);
// a = a.WithPaths(file2)
// .WithTimeout(1000)
// .WithRecurseSubRepositories(true);
// a.Validate();
//
// repo.Add(a);
//
//
// var c = new CommitCommand();
// c = c.WithMessage("Test log msg! " + i)
// .WithPath(file2)
// .WithAddRemove(true)
// .WithTimeout(1000);
// c.Validate();
//
// repo.Commit(c);
//
// //var c = new CommitCommand();
// });




Commit multi-threaed:
// var file = @"C:\Users\fd\Documents\Visual Studio 2010\Projects\RabbitMQ\Mercurial.Net.xml";
// var path = @"C:\Users\fd\Documents\Visual Studio 2010\Projects\RabbitMQ\Repo\";
//
// var repo = new Repository(path); // Must not be constructed in multi threaded code.
// //repo.Init(); // Only if repo doesn't exist.
//
// Parallel.For(0, 100, (Action<int>)delegate(int i)
// {
// string file2 = System.IO.Path.Combine(path, "File_" + i.ToString(CultureInfo.InvariantCulture));
// File.Copy(file, file2, true);
//
// var c = new CommitCommand();
// c = c.WithMessage("Test log msg! " + i)
// .WithPath(file2)
// .WithAddRemove(true)
// .WithTimeout(1000);
// c.Validate();
//
// repo.Commit(c);
//
// //var c = new CommitCommand();
// });

Get log:
        var file = @"C:\Users\fg\Documents\Visual Studio 2010\Projects\RabbitMQ\Repo\File_4";
        var path = @"C:\Users\fg\Documents\Visual Studio 2010\Projects\RabbitMQ\Repo\";
        var repo = new Repository(path);
        var l = new LogCommand();
        l = l.WithPath(file)
            .WithTimeout(1000)
            /*.WithOnlyFollowFirstParent(false)*/;
        l.Validate();
        var ret = repo.Log(l);
        string vvv = string.Join("\r\n", ret.Select(x => x.RevisionNumber.ToString() + x.CommitMessage.ToString()));
        MessageBox.Show(vvv);
Now I need to figure out how to check if :
  • a file is modified and not commited
  • a file is under version control or not.