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