0

我试图使用 c#.net 中的 SharpSVN API 来检查 Svn 服务器中是否存在分支名称或不存在于 svn 服务器中。我可以做吗?或者除了命令提示符之外还有其他方法可以在 C# 中执行此操作。我已经尝试过 thr cmd,但它在本地 PC 上工作,但在 IIS 服务器中发布后却没有。请建议我任何 sln。

4

1 回答 1

1

我们可以使用下面的代码来检查 svn 服务器中的分支是否存在,如下所示

try
{
        SvnClient clientN = new SvnClient();

        clientN.Authentication.Clear();//clear a previous authentication
        clientN.Authentication.DefaultCredentials = new System.Net.NetworkCredential("pkumar", "pkumar");
        Collection<SvnListEventArgs> list;

        if (clientN.GetList("svn://india01/Repo/branches/xyz", out list))//this will chk the branch exist or not. if not it will move to catch block
        {
            lblMsg.text = "branch exist";
             //do what you want here
        }
}
catch(SvnFileSystemException sfse)
{
    lblMsg.text = "branch does not exist";
}
于 2012-12-07T07:03:25.280 回答