Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SharpSvn Local File Rename Commit
  2. private string SvnRepository = "http://svnserver/svn/repo/trunk/";
  3.  
  4. public void Start() {
  5.     System.IO.File.Move("c:\LocalSvn\1.txt", "c:\LocalSvn\2.txt");
  6.     SvnRename("c:\LocalSvn\1.txt", "c:\LocalSvn\2.txt");
  7. }
  8. private Uri RelativePath(string sFullPath) {
  9.     return new Uri(SvnRepository + sFullPath.Replace(Path, "").Replace('\', '/').Substring(1));
  10. }
  11. public void SvnRename(string sPath, string sOldPath) {
  12.     using (SvnClient cl = new SvnClient()) {
  13.         Uri UriFrom = RelativePath(sOldPath);
  14.         Uri UriTo = RelativePath(sPath);                
  15.         cl.RemoteMove(UriFrom,UriTo
  16.             , new SvnMoveArgs { LogMessage = "Rename From:" + sOldPath + " To:"
  17.              + sPath });
  18.         //Local
  19.     }
  20. }