[英]Capturing Data before SVN Commit
我们有bug系统,用户可以在其中提交错误。 一旦通过代码签入解决了错误,我们必须手动将错误更新到修订号。
我正在寻找一种方式,在签入之前,它会要求用户填写一些细节,如bug等状态更改,这些将通过其api添加到bug中。
只有在成功之后才会发生提交。 这可能吗。
至于“向用户询问详细信息”......不,或者至少不容易,除非你有与你的bug跟踪系统集成的工具,可以在提交时捕获它(TortoiseSVN可以与某些集成,我认为......) 。
您可以做的是要求/建议用户将所需信息放在提交消息中。
然后你编写一个post-commit-hook来解析注释以获取bug跟踪号,状态变化等,然后将其与bug系统API一起使用来更新项目。
这正是我们将SVN与OnTime集成的方法。
示例提交消息:
E1234添加了代码以增强增强功能。
post-commit-hook读取提交信息,找到E1234
,并使用API查找项目。 我们还使用完整的提交信息更新字段,例如修订,用户和文件路径。
粗略了解C#中的情况:
static void Main(string[] args)
{
string sRepository = "file:///" + args[0]; //might need to flip the \
int nRevision = int.Parse(args[1]);
//use SVN commands or library to get commit information
//from sRepository for nRevision
string pattern = @"\b[DFET][0-9]+\b";
MatchCollection matches = Regex.Matches(log.log, pattern);
foreach (Match thisMatch in matches)
{
//find the matching bug tracking items
//and update using your API
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.