views:

299

answers:

3

Hello, I'm looking for a simple C# script that will export an SVN folder.

note: I have tortoise svn installed on this Win 2008 r2 server.

Thanks for your help!

example:

//SVN: 
string source = c:\project\websiteFiles\

//Export to:
string target = c:\inetpub\hockeyWebsite\

ExportSVNfolder(source, target)
{
// export the files

// wait till export is 100% complete

// return
}
+2  A: 

I would recommend using SharpSVN.

Jeff Yates
+3  A: 

Using SharpSvn's SvnClient Export Method it's really easy:

SharpSvn.SvnClient svnclient = new SvnClient();
svnclient.Export(new SvnUriTarget(source),
    target, new SvnExportArgs());
jan
A: 

You can automate all TortoiseSVN commands through the command line as described in the help files. Or you could install and invoke the subversion binaries directly.

One thing you might want to consider is the fact that the export command will only copy versioned files (files which are under version control). If you have additional files that also have to be copied (e.g. build-output or generated files), then I'd recommend to use another approach, e.g. such as the command line solution (using xcopy) shown by TheCatcher in this forum post:

  1. Create a text file (e.g. c:\ignore.txt) that lists all files which should not be exported/copied (normally this contains just one line: .svn to exclude the SVN folders).
  2. Create a batch file containing the following command to do the export:
  3. XCopy C:\WorkingCopyFolder C:\TargetFolder /EXCLUDE:C:\ignore.txt /E /C /I /F /R /Y
M4N