如何添加多个 SVN Hook
我有几个(在本例中为预提交)挂钩,我希望在同一事件期间运行它们。现在,它们都只是 shell 脚本,所以我知道我可以将它们连接起来让它们全部运行。但将来,可能会用 Perl、PHP 或其他语言编写其他脚本。
如何将多个不同的脚本作为单个钩子的一部分运行,并且子钩子的任何一个失败都按预期失败?
I've got several (in this case, pre-commit) hooks that I would like to have run during the same event. Right now, they are all just shell-scripts, so I know I could just concatenate them to get them all to run. In the future though, additional scripts may be written in Perl, PHP, or some other language as well.
How can I run several different scripts as part of a single hook, and have any one failure of the sub-hooks, fail as expected?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以从 SVN 中的单个预提交脚本调用每个脚本:
如果您使用脚本中正确的 shebang。
You can just invoke each script from the single pre-commit script in SVN:
You don't even need to mention the executable names (
sh
orphp
) if you use a proper shebang in your scripts.您可以尝试 SVN::Hooks Perl 模块允许您在单个配置文件中实现和集成许多挂钩,甚至可以将其版本控制在同一存储库中。
(披露:我是该模块的作者。)
You can try the SVN::Hooks Perl module which lets you implement and integrate many hooks in a single configuration file, which can even be kept versioned in the same repository.
(Disclosure: I'm the author of that module.)
与 @Gnustavo 基于 Perl 的解决方案非常相似,我还发现了一些其他(基于 PHP)系统,例如
如果测试失败,两个项目(以及其他“SVN Hooks”)都将无法提交。
Much like @Gnustavo's Perl-based solution, I've also found some other (PHP-based) systems, such as
Both projects (and other 'SVN Hooks') will fail a commit if there's a failure of the tests.