I want to create a .NET client for mercurial. Nothing fancy, just the basic stuff.
3 Answers
I've started writing a wrapper class library in .NET 4.0 for the Mercurial command line client. It's far far too early to use for anything yet, but you might want to keep an eye on it. Hopefully it'll prove useful to more people than just me.
The code is released as open source on bitbucket, here:
http://bitbucket.org/lassevk/mercurial.net
At the moment you can do basic log retrieval. The full syntax support for specying revsets is not in place, but you can do things like:
var repo = new Repository(@"c:\dev\some\project\repo");
var log = repo.Log(verbose: true, set: RevisionSet.FromRevision(10)); // 10:tip
var changesByMeThatModifiesIgnoreFile =
from changeset in log
where changeset.AuthorName == "Lasse V. Karlsen"
&& changeset.PathActions.Any(pa =>
pa.Path == ".hgignore" &&
pa.Action == PathActionType.Modify)
select changeset;
I plan on supporting all built-in commands so that you can commit, update, push, pull, check incoming and outgoing, clone, etc.

- 380,855
- 102
- 628
- 825
Like Chad says, use the command line. That is the official API. We go to great lengths to keep it stable in order to make it easy for scripts and programs to parse its output. See the compatibility rules for the details about how we try to ensure backwards compatibility and thus make it easy for programs to use Mercurial.
Because of the stable command line API, people can write wrapper libraries on top of it. For .Net, I would go with Mercurial.Net by Lasse Karlsen.

- 72,968
- 25
- 171
- 229
The question isn't identical, but the top answer applies just as well to your situation: Mercurial API for Java?.
Basically I think you'll probably just need to call the command-line functions. The official API seems to be for Python only.

- 1
- 1

- 73,098
- 23
- 151
- 149
-
Can it integrate with IronPython though? – George Mauer May 11 '09 at 19:59
-
Well, it's possible to run in pure python, so it could be IronPython compatible. I suppose it would be a nice hack to iron out (;-P) any incompatibilities. – Macke May 11 '09 at 20:00