tags:

views:

526

answers:

4

We have a report generator. Daily, it writes its data into a excel file.

For reasons of version controlling and file data safety, we need to alter this file, and commit the changes into a repository.

Do you recommend any .net SVN API you've used?

A: 

The simplest would be to spawn a process and call SVN.exe to commit your changes.

Here is a similiar question that was asked.

http://stackoverflow.com/questions/481247/does-anyone-know-of-a-good-c-api-for-subversion

Here is another resource

http://stackoverflow.com/questions/211765/svn-libraries-for-net

Jim Scott
+1  A: 

We are using tool that actually searching for installed TortoiseSVN in predefined locations and using it command-line api. If that is for Windows and it's for not redistribution - it might be easier to do.

Helpful code for cmd:

@echo off
if exist "%ProgramW6432%\TortoiseSVN\bin\TortoiseProc.exe" set patht=%ProgramW6432%
if exist "%ProgramFiles%\TortoiseSVN\bin\TortoiseProc.exe" set patht=%ProgramFiles%
if exist "%ProgramFiles(x86)%\TortoiseSVN\bin\TortoiseProc.exe" set patht=%ProgramFiles(x86)%

echo Placing SVN Commit
"%patht%\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"%CD%" /notempfile

If you still want to do that task from code - SharpSVN http://sharpsvn.open.collab.net is better choiсe

Mash
I would recommend using 'svn.exe' (console) over TortoiseProc (gui) for using Subversion from batch files, unless you would like to show dialogs :)
Bert Huijben
+1  A: 

You might be able to turn on Autoversioning for your repository. Since it uses WebDAV, you can treat the repository just like a network drive (Web Folder). And you can treat the file as a normal file, just open, modify, and save.

If it were me , I would create a new repository for the excel data files. I don't think I'd like my code being autoversioned :)

Steve K
+4  A: 

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);
}
Sander Rijken