我希望這不是太模糊。我正在編寫一個應用程序在我們的SVN服務器上執行後提交掛鉤。當我請求存儲庫URI時,我有時會得到與我的提交路徑不匹配的答案。爲什麼我的SharpSVN客戶端只返回存儲庫URI的一部分?
下面是如何獲得一般提交ARGS(編輯以添加更多細節):
public Collection<SvnLogEventArgs> GetCommitArgs(string strUri, long lngRevision)
{
try
{
using (SvnClient client = new SvnClient())
{
SvnLogArgs args = new SvnLogArgs();
Collection<SvnLogEventArgs> col;
args.Start = lngRevision;
args.End = lngRevision;
bool bolGotLog = client.GetLog(new Uri(strUri), args, out col);
return col;
}
}
catch
{
return null;
}
}
但這裏是我應得的回購URI(GetRepository()基本上只是重新格式化它看起來像一個URL):
colCommitArgs = GetCommitArgs(args[0], long.Parse(args[1]));
strRepository = GetRepository(args[0] + "/" + colCommitArgs[0].ChangedPaths[0].RepositoryPath.ToString());
的args[0]
實際上是指一組從呈交傳遞參數的個數。我發現ChangedPaths有時是空的。
例如,如果我提交到C:/Repositories/a_repo/somefolder/example.txt,我從SVN commit args返回的值僅爲C:/Repositories/a_repo/
。這可能是我們的SVN設置的一個問題(或者我對此不瞭解)。爲什麼有些文件夾被視爲存儲庫,其他文件夾只是考慮文件夾?有沒有辦法指定一個文件夾不只是一個文件夾?或者在SharpSVN中有不同的方式來獲取已提交的文件夾?我目前在原始URI的末尾連接了ChangedPaths[0].RepositoryPath
。
你的代碼並不真正對應你的問題的文字。請顯示給出'C:/ Repositories/a_repo /'的代碼,並顯示連接ChangedPaths [0] .RepositoryPath'的代碼。 –
我添加了額外的代碼。謝謝! – mrcoulson
。除非通過可選的SvnLogArgs對象將.RetrievePaths傳遞爲true,否則,ChangedPaths將爲null。 –