How to get latest revision number from SharpSVN?

Tomasz Smykowski picture Tomasz Smykowski · Mar 26, 2009 · Viewed 16.2k times · Source

How to get latest revision number using SharpSVN?

Answer

Bert Huijben picture Bert Huijben · Mar 26, 2009

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));
}