[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Subversion API's for .NET - javahl & IKVM

From: Kyle Kline <kyle.kline_at_gmail.com>
Date: 2005-05-02 16:07:02 CEST

All,

I've been looking on the net for a while to find a decent way to
invoke SVN client APIs from .NET (C#). There are many approaches --
some wrap the CLI, some use managed C++, some use PInvoke. My pref
though was to find something a little more manageable while still
being more performant than repeatedly invoking the CLI.

Using IKVM (http://www.ikvm.net) + a timely bugfix from Jeroen
Frijters (thx!), IKVM was able to successfully convert the
svnjavahl.jar into a .NET managed assembly. I was then able to
successfully invoke it from C# (IKVM is able to allow JNI to occur to
libsvnjavahl-1.dll in the .NET-ified jar).

Note you need to use the 0.14 rc1 build --
(http://www.frijters.net/ikvmbin-0.14-rc1.zip) . I have tested this
on .NET 1.1 and Mono 1.1.6 on Windows and both work splendidly.

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.

In this way, .NET developers could leverage the excellent work of the
javahl binding devs. I had some success with the pure java JavaSVN
client library as well (http://tmate.org/svn/) but didn't play around
with it as much since it doesn't yet support locking.

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());
                }
        }

-Kyle

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon May 2 16:09:14 2005

This is an archived mail posted to the Subversion Users mailing list.