我如何使用 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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不知道 SharpSVN,但是如果您按照您的描述创建一个钩子脚本,您将获得 %repos% 和 %txn% 作为参数。
通过这些数据,您可以查看给定存储库的事务 (%txn%)。通常您可以通过使用
然后您将收到日志消息来执行此操作。
所以你应该在 SharpSVN 界面中寻找与 svnlook 等效的东西。
I do not know SharpSVN, however if you create a hook script as you describe, you get as arguments %repos% and %txn%
With these data you can look into the transaction (%txn%) of the given repository. Usually you do this by using
Then you will get the log-message.
So you should look for an equivalent to svnlook in sharpSVN interface.
不久前,我为 svnlook.exe 编写了一个 C# 包装器。我使用这个将提交消息发送到错误跟踪器(如果提供了票证 ID)。下面找到它,也许对你有用。
Some time ago I've written a C# wrapper for the svnlook.exe. I used this one to send commit messages to a bug tracker (if a ticket id was provided). Find it below, maybe it is useful for you.
使用最近的 SharpSvn 版本,您可以用来
解析预提交挂钩的参数,然后使用
它来获取日志消息、更改的文件等
Using a recent SharpSvn release you can use
to parse the arguments of a pre-commit hook and then use
to get to the log message, changed files, etc.
我刚刚完成了自己构建 Hooks 应用程序的过程,并且不需要 SharpSVN 来查看提交消息。假设您已经为自己构建了一个控制台应用程序,请尝试直接调用 svnlook.exe 的代码:
确保 svnlook.exe 的位置已添加到计算机的路径环境变量中,以便可以从任何位置执行上述内容。
I've just gone through the process of building a hooks app myself and SharpSVN isn't required for looking at commit messages. Assuming you've built yourself a console app already, try this code which calls svnlook.exe directly:
Make sure the location of svnlook.exe is added to the path environment variable of your machine so the above can be executed from any location.