Search code examples
c#svnsharpsvn

How to get latest revision number from SharpSVN?


How to get latest revision number using SharpSVN?


Solution

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