如何添加多个 SVN Hook

发布于 2024-09-03 00:43:41 字数 161 浏览 3 评论 0原文

我有几个(在本例中为预提交)挂钩,我希望在同一事件期间运行它们。现在,它们都只是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

月朦胧 2024-09-10 00:43:41

您可以从 SVN 中的单个预提交脚本调用每个脚本:

#!/bin/sh

sh do_this.sh
php do_that.php
...

如果您使用脚本中正确的 shebang。

You can just invoke each script from the single pre-commit script in SVN:

#!/bin/sh

sh do_this.sh
php do_that.php
...

You don't even need to mention the executable names (sh or php) if you use a proper shebang in your scripts.

无法言说的痛 2024-09-10 00:43:41

您可以尝试 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.)

时光倒影 2024-09-10 00:43:41

与 @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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文