繼這裏找到代碼: How to check if file is under source control in SharpSvn?SharpSVN不遍歷所有子目錄和文件
我試圖做一個小的實用程序,將遍歷一個指定的文件夾,並打印出所有的文件的狀態。
private void btnCheckSVN_Click(object sender, EventArgs e)
{
ParseSVNResults(CheckSVN());
}
private Collection<SvnStatusEventArgs> CheckSVN()
{
string path = @"C:\AMG\trunk\AMC";
if (!Directory.Exists(path))
return null;
DevExpress.Utils.WaitDialogForm wait = new DevExpress.Utils.WaitDialogForm();
wait.Caption = "Please wait, loading SVN file statuses. This may take a moment.";
wait.Caption += Environment.NewLine + path;
wait.Show();
SvnClient client = new SvnClient();
SvnStatusArgs sa = new SvnStatusArgs();
sa.Depth = SvnDepth.Infinity;
Collection<SvnStatusEventArgs> statuses;
client.GetStatus(path, sa, out statuses);
wait.Close();
return statuses;
}
private void ParseSVNResults(Collection<SvnStatusEventArgs> results)
{
if (results == null)
return;
int modified = 0;
int unversioned = 0;
foreach (SvnStatusEventArgs item in results)
{
memoEditSVNFiles.Text += item.LocalContentStatus.ToString() + " -- " + item.Path + Environment.NewLine;
if (item.LocalContentStatus.ToString() == "Modified")
modified++;
else if (item.LocalContentStatus.ToString() == "NotVersioned")
unversioned++;
}
memoEditSVNFiles.Text += Environment.NewLine + "Modified: " + modified + Environment.NewLine;
memoEditSVNFiles.Text += "Not Versioned: " + unversioned + Environment.NewLine;
memoEditSVNFiles.Text += "Total: " + results.Count;
}
當代碼執行,我一共拿到147個文件夾&。實際的文件夾有幾千個文件。是否有可能我在太多文件和SharpSVN只是在一段時間後退出?
編輯;我只是嘗試創建約100個文本文件並將30個文件夾放入3個文件夾中,然後「嵌套」它們。所以我有;
C:具有\ AMG \樹幹\測試〜30個文件 C:\ AMG \樹幹\測試\ Folder1中,其具有〜30個文件 C:\ AMG \樹幹\測試\ Folder1中\子,其具有另外的30當我在C:\ AMG \ trunk \ test上運行上面的代碼而不是我的代碼片段中的給定路徑時,輸出顯示1個文件總數。