I Have to Access/Commit/Update Svn Repository in Wpf Application Using Svn API or Libraries

i have to access/commit/update SVN repository in WPF application using SVN API or libraries

SharpSvn was desiged for .Net 2.0 and Subversion 1.5 and later. It integrates all subversion dependencies in a single set of dll that is directly usable from .Net (XCopy deployable). One of the other strong points of SharpSvn is that it hides all memory management and transforms Subversion errors in exceptions, and more importantly vice versa. (Makes debugging callbacks very easy)

NSvn was used by AnkhSVN before AnkhSVN 2.0. It moved to SharpSvn after that.

The IronSvn project on Codeplex closed down. (It suggests using SharpSvn).

Svn# and its 2.0 successor Svn.Net are plain wrappers of the Subversion C api. They required the binaries of a subversion release to work. And you must manage the apr pools and some of the apr collection marshalling yourself from managed code. This is the only cross platform solution in this list. (Works just as well on linux)

How to programatically do file versioning with SVN and .NET?

You should take a look at the SharpSvn .NET library. You will probably need checkout and commit commands:

Checking out:

string wcPath = "c:\\my working copy";
using (SvnClient client = new SvnClient())
{
client.CheckOut(new Uri("http://server/path/to/repos"), wcPath);
}

Committing:

string wcPath = "c:\\my working copy";
SvnCommitArgs a = new SvnCommitArgs();
a.LogMessage = "My log message";

using (SvnClient client = new SvnClient())
{
client.Commit(wcPath, a);
}

Are there Windows API binaries for Subversion or do I have to build SVN to call the API from Windows C++?

You need the dev (e.g. svn-win32-1.6.16_dev.zip) package from here. Probably download also the binaries (e.g. svn-win32-1.6.16.zip) of the tools (DLLs are there).

Best client for SVN / WIndows for READ ONLY ;)?

Simply use the basic subversion client binary, a compiled Windows package with installer can be downloaded at CollabNet.

Just add the program path to $PATH and you can do a svn update or svn checkout from anywhere on your system. You can even automate the processes using batch files or Windows scripts.

How to get a list of uncommitted files from tortoise or svn

I don't think that TortoiseSVN can help you with this, but it should not be too much effort doing it yourself using a C# SVN library.

Take a look at this question: Does anyone know of a good C# API for Subversion?.

determine SVN checked in state of a file in c#

Do you ask how to detect what files stored in SVN folder(s) are changed?

You ask to do that without interacting with SVN, but I would recommend avoid this because file or folder structure can be changed by Subversion team in future.

Try to use SharpSVN I use it in one of my projects. It handy, stable, has nice API and actively developed.

Also check comments in your question. Anyway you can check source code of SharpSVN to undestand how to make it by yourself

How to handle new versions of a .NET application in Subversion?

There are generally a couple of schools of thought regarding version control, but the one I've encountered most often that makes sense to me is:

  • You do all development that drives the project forward on the main branch, aka HEAD in CVS and 'trunk' in subversion. This one receives all the changes like the ones you describe, including changing GUI libraries, updating 3rd party tools and all that. The tip of that branch should always reflect the latest and hopefully greatest version of the software, but it will never see the light of day as a release.
  • For every release, you create a release branch. All work related to the release and only to the release goes on this specific branch. These should mainly be bug fixes. Changes that you may make on this branch might get merged back into the main branch, but I wouldn't expect many, if any changes from the main branch into the release branch. The main branch is a moving target whereas the release one isnt.

What is the quickest way to check if an svn working copy has changes?

If you just need the result: modified vs unmodified you could do something like this C# code:

// using SharpSvn;

bool foundModification = false;
using (SvnClient client = new SvnClient()
{
client.Status(@"C:\my\working\copy",
delegate(object sender, SvnStatusEventArgs e)
{
foundModification = true;
e.Cancel = true;
});
}

This does +- the absolute minimum required to find if there are actual changes in your working copy and stops the moment it found the first result.

SubWCRev and svnversion use a similar approach, but do some additional checks inside wc.db (assuming Subversion 1.7 or newer).

You probably want to extend the delegate a bit to skip some kinds of changes. (The Changelist is available as a property on the SvnStatusEventArgs object)

Does anyone know of a good C# API for Subversion?

Have a look at SharpSVN. This is an open-source binding of the Subversion Client API for .Net 2.0 applications.

For example, this library is used by the AnkhSVN Visual Studio Add-In.



Related Topics



Leave a reply



Submit