Question

I'm using this code snippet for finding top revision number from svn but my page is not responding. It keeps on searching only

using (SvnClient client = new SvnClient())
{
    SvnInfoEventArgs info;
    Uri repos = new Uri("svn://india01/repository/branches/mybranch1");
    client.GetInfo(repos, out info);
    lblMsg.Visible = true;
    lblMsg.Text = (string.Format("The last revision of {0} is {1}", 
           repos, info.Revision));
}

I want to fetch the top revision number from the mybranch1 which is in the svn repository at svn://india01/repository/branches/mybranch1.

Was it helpful?

Solution

here we need to add the SharpSvn Api dll reference into c# project. link for SharpSvn package download and then follow the below link for example code for getting top revision number

SvnInfoEventArgs statuses;
SvnClient client = new SvnClient();
client.Authentication.Clear();//clear a previous authentication
client.Authentication.DefaultCredentials = 
    new System.Net.NetworkCredential("usr", "pass");
client.GetInfo("svn://india00/Repo/branches/xyz", out statuses);
int LastRevision = (int)statuses.LastChangeRevision;`

add references as

using SharpSvn;
using System.Collections.Generic;
using System.Collections.ObjectModel;`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top