我试图弄清楚如何获取特定修订的提交消息.看起来SvnLookClient可能是我需要的
我在SO上找到了一些代码,看起来像我需要的,但是我似乎缺少了一些.
我找到的代码(如此):
using (SvnLookClient cl = new SvnLookClient())
{
SvnChangeInfoEventArgs ci;
//******what is lookorigin? do I pass the revision here??
cl.GetChangeInfo(ha.LookOrigin, out ci);
// ci contains information on the commit e.g.
Console.WriteLine(ci.LogMessage); // Has log message
foreach (SvnChangeItem i in ci.ChangedPaths)
{
}
}
解决方法:
SvnLook客户端专门用于在存储库挂钩中使用.它允许访问未提交的修订,因此需要其他参数. (这是SharpSvn的“ svnlook”命令的等效项.如果需要“ svn”的等效项,则应查看SvnClient).
外观来源是:
*储存库路径和交易名称
*或存储库路径和修订号
例如.在预提交挂钩中,修订尚未提交,因此您不能像通常那样通过公共URL访问它.
该文档说(在pre-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))
}
原文地址:https://codeday.me/bug/20191107/2003205.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。