Getting Started

As a general rule of thumb, SubversionSharp naming use a CamelCase convention to be C#-like and names that are coherent with the original naming of the C API from Subversion. So the documentation from the C API  is a good reference to use SVN#. However, it has also an embryonic object-oriented class to hide the management of APR pools and some special features. This article aims to show you how to start using SVN#.

For the documentation, you will have to use the Subversion C API documentation because our documentation is stucked on the TODO list. We have try to use constant naming rules to embed each type and wrap each function of the C API when possible.
For APR structure from AprSharp, the documentation of the Apache Portable Runtime may also be of use.

Object Oriented embryonic class

Added to the simple wrapping of the C API which is obviously not object oriented, we have start a lightweight object-oriented approach through our SvnClient class, which helps hiding some requirement due to APR pools management. Using this one, the most used functions can easily be called without the need of understanding all the complexity of APR pools.

Some structures, like the AprArray wrapper, has also been extended to be type-safe and implement an ICollection interface, so you can easily iterate on them, which is natural in C#. Callbacks are also
embedded to provide native C# types to the user callback function.

Test code

In the test subdirectory of the sources, there is a work-in-progress that try to imitate the current command-line client of Subversion using our API1. You can learn a lot from this one.

Sample code

This sample code show you how to initialize an SvnClient object and call the CheckOut function with a sample callback. If you run it as is, this code will check out the SubversionSharp source code from our repository into the current folder. Please, change the URL and use your own repository for testing to avoid loading our server unnecessarily.

using System;
using Softec.AprSharp;
using Softec.SubversionSharp;
class MainClass
   public static int Main() {
       SvnClient client = new SvnClient();
       client.AddSimpleProvider(); // not absolutly required here since there is no authentication
       client.Context.NotifyFunc =
          new SvnDelegate(new SvnWcNotify.Func(NotifyCallback));

                      new SvnRevision(Svn.Revision.Head),

  public static void NotifyCallback(IntPtr baton, SvnPath Path,
                       SvnWcNotify.Action action, Svn.NodeKind kind,
                       AprString mimeType, SvnWcNotify.State contentState,
                       SvnWcNotify.State propState, int revNum) {
       switch(action) {
           case SvnWcNotify.Action.UpdateAdd:
  1. ^ To be compiled, this tools require Mono.GetOptions that is available from