Search This Blog

Saturday, February 7, 2009

Accessing SVN directly from C#

I am working on a project where I need to automatically initiate a Commit to SVN repository.

Researching existing projects using C# 2.0+ .net to access subversion.

Inactive project to recreate SVN DotSVN in .NET. Has file browser working.
Blog for DotSVN


http://sharpsvn.open.collab.net/ - Not 100% stable yet.
http://www.pumacode.org/projects/svndotnet/ - Still In Development as of 1/2009.

http://ankhsvn.open.collab.net/ - Ankh .NET IDE addin.

Sample Code from http://svn.haxx.se/users/archive-2005-05/0065.shtml
Suggestion: When new SVN releases come out, all it takes is a simple
ikvmc svnjavahl.jar -reference IKVM.GNU.Classpath.dll
and make sure that your program can access ikvm-native.dll, classpath
dll, and the libsvnjavahl-1.dll.

Sample code (abbreviated):

using org.tigris.subversion.javahl;

public void ListRepoDirs()
{
SVNClient client = new SVNClient();
DirEntry[] dirs = client.list("svn://testsrvr/testrepo1/",
Revision.HEAD, true);

foreach(DirEntry dir in dirs)
{
Console.WriteLine(dir.getPath() + ", last mod: " + dir.getLastAuthor());
}
}

No comments: