c#:SharpSvn关于SVN操作

下载SharpSvn 1.8
在工程里引用其中的 SharpSvn.dll

Update

public static void SvnDownload()
{
    using (SvnClient client = new SvnClient())
    {
        //client.Authentication.Clear();
        client.Authentication.UserNamePasswordHandlers += new EventHandler<SharpSvn.Security.SvnUserNamePasswordEventArgs>(
        delegate (Object s, SharpSvn.Security.SvnUserNamePasswordEventArgs ee)
        {
            ee.UserName = "abc";
            ee.Password = "defg";
        });

        client.Authentication.SslServerTrustHandlers += new EventHandler<SharpSvn.Security.SvnSslServerTrustEventArgs>(
        delegate (Object ssender, SharpSvn.Security.SvnSslServerTrustEventArgs se)
        {
                    // Look at the rest of the arguments of E whether you wish to accept

                    // If accept:
            se.AcceptedFailures = se.Failures;
            se.Save = true; // Save acceptance to authentication store
                });

        Console.WriteLine(client.CheckOut(
          new Uri("d:svn	emp	est.txt"),
          @"C:Users
huangDesktophi"));
    }
}

Commit(上面登录的代码就不重复了)

using (SvnClient client = new SvnClient())
{
    SvnCommitArgs commitArgs = new SvnCommitArgs();
    commitArgs.Depth = SvnDepth.Empty;
    commitArgs.LogMessage = "My Test Commit";
    SvnCommitResult commitResult = null;
    client.Commit(@"d:svn	emp	est.txt", commitArgs, out commitResult);
}

获取日志

using (SvnClient client = new SvnClient())
{
    StringBuilder strBuilder = new StringBuilder();
    SvnClientReporter reporter = new SvnClientReporter(client, strBuilder);
}

取消操作

using (SvnClient client = new SvnClient())
{
    //do something
    client.Cancel +=
        delegate (object s, SvnCancelEventArgs e)
        {
            e.Cancel = true;
        };
    //do svn Operations
}

link:
http://www.cnblogs.com/goody9807/archive/2012/11/01/2749938.html
http://www.knowsky.com/897805.html