如何使用SharpSVN访问SVN预提交消息? [英] How can i get access to the SVN pre-commit message using SharpSVN?

查看:123
本文介绍了如何使用SharpSVN访问SVN预提交消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到我只能设置为%repos%和%txn%

i see that all I can set to is %repos% and %txn%

我该如何使用它们来获取提交消息(以我为例,因此我可以解析票证编号,以便可以在提交之前查看错误数据库中是否存在该票证编号)

how can I use those to get to the commit message (in my case, so i can parse out the ticket number so i can see if it exists in the bug database before committing to it)

推荐答案

使用最新的 SharpSvn 版本可以使用

Using a recent SharpSvn release you can use

SvnHookArguments ha; 
if (!SvnHookArguments.ParseHookArguments(args, SvnHookType.PreCommit, false, out ha))
{
    Console.Error.WriteLine("Invalid arguments");
    Environment.Exit(1);  
}

解析预提交钩子的参数,然后使用

to parse the arguments of a pre-commit hook and then use

using (SvnLookClient cl = new SvnLookClient())
{
    SvnChangeInfoEventArgs ci;

    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)
    {

    }
}

获取日志消息,更改的文件等.

to get to the log message, changed files, etc.

这篇关于如何使用SharpSVN访问SVN预提交消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆