SvnLook客戶端專門針對在存儲庫掛鉤中使用。它允許訪問無限制的修訂,因此需要其他參數。 (這是'svnlook'命令的SharpSvn等價物,如果你需要'svn'等價物,你應該看看SvnClient)。
一看產地可以是: * A庫路徑和事務名 *或庫路徑和版本號
例如在預提交鉤子中,修訂版尚未提交,因此您無法通過公開網址訪問它,就像您通常所做的那樣。
文檔說(預commit.tmpl):
# The pre-commit hook is invoked before a Subversion txn is
# committed. Subversion runs this hook by invoking a program
# (script, executable, binary, etc.) named 'pre-commit' (for which
# this file is a template), with the following ordered arguments:
#
# [1] REPOS-PATH (the path to this repository)
# [2] TXN-NAME (the name of the txn about to be committed)
SharpSvn通過提供可幫助您:
SvnHookArguments ha;
if (!SvnHookArguments.ParseHookArguments(args, SvnHookType.PostCommit, false, out ha))
{
Console.Error.WriteLine("Invalid arguments");
Environment.Exit(1);
}
,它解析這些參數爲您服務。 (在這種情況下,它非常簡單,但有更高級的鉤子。鉤子可以在更新的Subversion版本中接收新的參數)。您需要的值在ha的.LookOrigin屬性中。
如果您只想擁有特定修訂範圍(1234-4567)的日誌消息,則不應該查看SvnLookClient。
using(SvnClient cl = new SvnClient())
{
SvnLogArgs la = new SvnLogArgs();
Collection<SvnLogEventArgs> col;
la.Start = 1234;
la.End = 4567;
cl.GetLog(new Uri("http://svn.collab.net/repos/svn"), la, out col))
}
SvnLookClient是相當於'svnlook'應用程序的庫。這個類被設計用於使用倉庫鉤子(就像svnlook一樣)。 – 2009-08-11 09:03:13