I'm using the SharpSvn library. I want to check if the files that I have locally are the same with those on the subversion server. Does anyone know how I do this? Currently this is what I'm trying to do but it is saying "Unable to connect to a repository at URL"

    public bool IsDirectoryTheSame(string folderpath)
    {
        var IsSameDirectory = false;
        var installfolderlocal = GetInstallationFolder(folderpath);
        using (SvnClient svnClient = new SvnClient())
        {
            SvnUriTarget target1 =
                new SvnUriTarget(
                    new Uri(string.Format("{0}{1}", svnclientpath, folderpath)));
            SvnUriTarget target2 =
                new SvnUriTarget(
                    new Uri(installfolderlocal));

            using(var stream = new MemoryStream())
            {
            IsSameDirectory =  svnClient.Diff(target1,target2,stream);
            }
        }
        return IsSameDirectory;
    }
有帮助吗?

解决方案

I'm assuming from your question that the local files are version controlled, in which case you can use GetInfo() to get the latest revision number for the file in the repository and compare that with the latest revision number for your local file.

Another suggestion would be to use GetUriFromWorkingCopy(). I personally haven't tested it myself, but it's worth a shot.

At any rate, you should use diffing as a last resort since that can be an expensive call. If the file is not version-controlled, though, that may be your only shot.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top