让我们说这个文件夹是\ trunk \ source
我不打算结帐或提交,只需阅读列表
我也希望阅读所有文件,而不仅仅是已更改的文件。
答案 0 :(得分:16)
bool gotList;
List<string> files = new List<string>();
using (SvnClient client = new SvnClient())
{
Collection<SvnListEventArgs> list;
gotList = client.GetList(projectPath, out list);
if (gotList)
{
foreach (SvnListEventArgs item in list)
{
files.Add(item.Path);
}
}
}
答案 1 :(得分:7)
在记事本中匆匆写了这个;遗憾。
SvnClient client = new SvnClient();
client.Authentication.DefaultCredentials = new NetworkCredential("svnuser", "svnpass");
SvnUriTarget folderTarget = new SvnUriTarget("https://mysvnserver.com/mysvnpath");
List<String> filesFound = getFolderFiles(client, folderTarget);
// GetFolderFiles
// Function that, given a SvnClient and Target to a folder, returns a list of files
private List<String> getFolderFiles(SvnClient client, SvnTarget folderTarget)
{
List<String> filesFound = new List<String>();
List<SvnListEventArgs> listResults;
if (client.GetList(folderTarget, out listResults))
{
foreach (SvnListEventArgs item in listResults)
if (item.Entry.NodeKind == SvnNodeKind.File)
filesFound.Add(item.Path);
return filesFound;
}
else
throw new Exception("Failed to retrieve files via SharpSvn");
}