开发者

C# Code to Export an SVN folder

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\ho开发者_开发百科ckeyWebsite\

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

// wait till export is 100% complete

// return
}


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

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


I would recommend using SharpSVN.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜