commitsharpsvnfile-rename

SharpSvn Local File Rename Commit


I'm using SharpSVN to do an "Commit" after a file rename in my local copy

instead of doing Svn.Delete(Src) -> Svn.Add(Dst).
i want to use a different method To keep tracing revision info of my file

The rename function move the info in Server-Side ,
from the old target to the new target by using Svn.RemoteMove() function.

How can I copy the "svn-infos" in the Local-Side?

I've tried to do cl.Move(src,dst) on my local file,
but I am getting message that the source file not found.

Here is my code :

private string SvnRepository = "http://svnserver/svn/repo/trunk/";

public void Start() {
    System.IO.File.Move("c:\\LocalSvn\\1.txt", "c:\\LocalSvn\\2.txt");
    SvnRename("c:\\LocalSvn\\1.txt", "c:\\LocalSvn\\2.txt");
}
private Uri RelativePath(string sFullPath) {
    return new Uri(SvnRepository + sFullPath.Replace(Path, "").Replace('\\', '/').Substring(1));
}
public void SvnRename(string sPath, string sOldPath) {
    using (SvnClient cl = new SvnClient()) {
        Uri UriFrom = RelativePath(sOldPath);
        Uri UriTo = RelativePath(sPath);                
        cl.RemoteMove(UriFrom,UriTo
            , new SvnMoveArgs { LogMessage = "Rename From:" + sOldPath + " To:" 
             + sPath });
        //Local
    }
}

Solution

  • i've just found out that cl.Delete() cl.Add() keeping the history of the file so i dont need the cl.RemoteMove() to help me to keep tracking on the file !