简体   繁体   English

SVN预提交检查

[英]SVN Pre Commit check

We have two branches A and B with the same source code structure我们有两个分支 A 和 B,具有相同的源代码结构

Any check in that happens in B , need to happen in A as well.在 B 中发生的任何检查也需要在 A 中发生。

For example : There is a file Employee.java in branch A and branch B in the below folder project/src/main/java/com/mycomp/Employee.java例如:在以下文件夹project/src/main/java/com/mycomp/Employee.java 的分支 A 和分支 B 中有一个文件Employee.java

While checking in the file Employee.java to branch B , I need to check if the same file is already checked into branch A by comparing the contents of Employee.java in both the branches .在将文件 Employee.java 签入到分支 B 时,我需要通过比较两个分支中 Employee.java 的内容来检查相同的文件是否已经签入到分支 A 中。 If not , I should not allow the developer to commit如果没有,我不应该允许开发人员提交

Is it possible to implement such logic in SVN pre commit hook and fail the commit ?是否有可能在 SVN 预提交钩子中实现这样的逻辑并使提交失败? Is there any out of the box solution from SVN to implement such checks ? SVN 是否有任何开箱即用的解决方案来实现此类检查?

Well, while I find the use case rather strange, it can be achieved with SVN pre commit hooks (some scripting required).好吧,虽然我发现用例很奇怪,但可以通过 SVN 预提交挂钩(需要一些脚本)来实现。

Here is a decent write up of how to create and use pre commit hooks:这是一篇关于如何创建和使用预提交钩子的不错的文章:

http://wordaligned.org/articles/a-subversion-pre-commit-hookhttp://wordaligned.org/articles/a-subversion-pre-commit-hook

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM