为特定文件夹触发 SVN 预提交挂钩
我们的一个客户的 SVN 存储库在单个存储库下有相当多的项目。现在我想通过预提交挂钩检查项目之一的编码标准。
如果我配置预提交,它将影响存储库中的所有项目(文件夹),如何告诉钩子脚本仅当来自特定文件夹(或项目)的文件时才触发(检查编码标准) )已承诺。
更新
编码标准是为 Zend 设计的,我将使用 PHPCS(PHP 编码标准) 来验证编码标准。
One of our client's SVN repository has quite a bunch of projects under the single repository. Now I want to check coding-standard for one of the project via pre-commit hook.
If I configure the pre-commit, it is going to affect all the projects (folders) in the repository, how do I tell the hook-script to trigger (check the coding standard) only when a file from a particular folder (or project) is committed.
UPDATE
The coding standard is intentional for Zend and I am going to use PHPCS (PHP Coding Standard) to validate the coding-standard.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在预提交中使用 svnlook 来查看更改的路径,如果该路径包含您正在考虑的项目,请执行编码标准等。
您可以使用 dirs-changed > 子命令(以及
--transaction
标志):http://svnbook.red-bean.com/en/1.5/ svn.ref.svnlook.c.dirs-changed.html
或
changed
子命令:http://svnbook.red-bean.com/en/1.5/svn。 ref.svnlook.c.changed.html
使用 svnlook 的预提交示例:http://wordaligned.org/articles/a-subversion-pre-commit-hook
Use
svnlook
in the pre-commit to see the paths changed, and if the path contains the project you are considering, do the coding standards etc.You can use the
dirs-changed
subcommand (and the--transaction
flag):http://svnbook.red-bean.com/en/1.5/svn.ref.svnlook.c.dirs-changed.html
Or the
changed
subcommand:http://svnbook.red-bean.com/en/1.5/svn.ref.svnlook.c.changed.html
Example of a pre-commit using svnlook: http://wordaligned.org/articles/a-subversion-pre-commit-hook
你不能。该脚本需要检查所有受影响的路径(可以不止一个)并采取相应的措施。
You cannot. The script needs to check all the affected paths (they can be more than one) and act accordingly.