簡體   English   中英

如何從SVN信息庫獲取分支的最高修訂版本號?

[英]How do I get the top revision number for a branch from SVN repository?

我正在使用此代碼段從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));
}

我想從獲取頂級版本號mybranch1這是在svn存儲庫svn://india01/repository/branches/mybranch1

在這里,我們需要將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;`

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM