2

我正在使用此代码片段从svn中查找最高修订号,但我的页面没有响应。它只继续搜索

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

我想从svn存储库中mybranch1获取最高修订号。svn://india01/repository/branches/mybranch1

4

1 回答 1

1

这里我们需要将 SharpSvn Api dll 引用添加到 c# 项目中。 SharpSvn 软件包下载链接然后按照以下链接 获取最高修订号的示例代码

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;`

添加引用为

using SharpSvn;
using System.Collections.Generic;
using System.Collections.ObjectModel;`
于 2012-12-07T06:55:43.833 回答