1

有没有什么好的方法可以使用 svn pre-commit hooks 等来防止开发人员忘记添加文件?具体来说,如果用户有一个本地的未版本化文件,其路径/文件名与某个正则表达式模式匹配(在这种特殊情况下为 rails 数据库迁移),我希望提交失败。用户教育(在提交之前始终运行 svn status 和 svn diff)、羞辱等到目前为止已被证明不足以防止此类问题偶尔发生,

4

2 回答 2

2

You need to have a continuous integration setup that continually builds your development branch. Any failures are immediately sent to the user. This does require you to have a very well developed set of test suites. As for database migrations, it can help you in consistently testing long before your code ever reaches your end users.

That said, your best bet might simply be a pre-commit hook that aborts if there are any files in the working copy that aren't staged into the repository.

于 2011-03-13T15:38:35.190 回答
1

预提交钩子是在服务器端实现的,所以没有。有一些客户端,例如 TortoiseSVN,允许客户端提交钩子,但这不是标准的。正如 Chris Kaminski 建议的那样,您确实应该通过使用 CI 服务器使构建失败来做这种事情。

于 2011-03-13T15:49:07.430 回答