![](/img/trans.png)
[英]How to check if files on svn are the same with the local files C#(sharpsvn)
[英]how can i check a branch exists in svn server or not using SharpSVN API in C#
我正在嘗試使用c#.net中的SharpSVN API來檢查Svn服務器中是否存在分支名稱,或者不檢查svn服務器中的分支名稱。 我可以做嗎? 還是有其他方法可以在C#中執行,除了thr命令提示符。 我已經嘗試過thr cmd,但是它可以在本地PC上運行,但是在IIS服務器中發布后卻不能。 請建議我任何信息。
我們可以使用下面的代碼來檢查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";
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.