Check updates in specific directory in svn c#

1k Views Asked by At

I'm trying to check if a certain svn subdirectory was updated, and if so, update my entire working directory.

Here is what I do:

SvnClient svnClient = new SvnClient();
SvnWorkingCopyClient workingCopyClient = new SvnWorkingCopyClient();

SvnInfoEventArgs svnInfo;
SvnWorkingCopyVersion workingCopyVersion;

Uri svnRepository = new Uri(m_svnAddress + /local/trunk/somefolder");

svnClient.GetInfo(svnRepository, out svnInfo);
workingCopyClient.GetVersion("C:\\Workspace\\somefolder", out workingCopyVersion);


int recentSvnRevision = unchecked((int)svnInfo.Revision);
int currentVersion = unchecked((int)workingCopyVersion.End);

if (recentSvnRevision != currentVersion)
   // Do stuff

The problem is that recentSvnRevision is set to the latest revision number of the entire directory on the svn, and not the revision of the /local/trunk/somefolder directory.

Any ideas?

1

There are 1 best solutions below

0
On

You can use this to get the latest revision number for a specific directory:

SvnInfoEventArgs info;
client.GetInfo(RemotePath, out info);
return info.LastChangeRevision;

where RemotePath is the directory of the folder you want to check (ex. https://svn.exmaple.com/local.../somefolder), as opposed to the path of the repository.