C# – How to get latest revision number from SharpSVN

csharpsvnsvn

How to get latest revision number using SharpSVN?

Best Answer

The least expensive way to retrieve the head revision from a repository is the Info command.

using(SvnClient client = new SvnClient())
{
   SvnInfoEventArgs info;
   Uri repos = new Uri("http://my.server/svn/repos");

   client.GetInfo(repos, out info);

   Console.WriteLine(string.Format("The last revision of {0} is {1}", repos, info.Revision));
}