【问题标题】:How do I get the top revision number for a branch from SVN repository?如何从 SVN 存储库获取分支的最高修订号?
【发布时间】:2014-09-16 18:47:03
【问题描述】:

我正在使用此代码 sn-p 从 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://india01/repository/branches/mybranch1svn 存储库中。

【问题讨论】:

  • 你试过用 http:// 代替 svn:// 协议吗?
  • 我可以使用 http:// 协议代替 svn:// 协议吗?
  • 但是在运行网页后它正在寻找如下文件 f:\qqn\sharpsvn-dist\src\sharpsvn\svnclientargs.cpp
  • 在将协议从 SVN:// 更改为 Http:// 后显示以下错误 http://india01/repository/branches/mybranch1': could not connect to server india01`

标签: c# visual-studio-2008 sharpsvn


【解决方案1】:

这里我们需要将 SharpSvn Api dll 引用添加到 c# 项目中。 link for SharpSvn package downloadthen follow the below link for example 获取最高修订号的代码

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-22
    • 1970-01-01
    • 2010-10-09
    • 1970-01-01
    • 2010-10-12
    • 2010-10-19
    • 1970-01-01
    相关资源
    最近更新 更多