阻止签入 SVN
我的团队使用 SVN 作为我们的软件平台,并且我们定期创建标签以帮助保持模块版本的一致性。据我了解,最佳实践是标签创建后不要修改。然而,有时似乎诱惑太大,对其中一个标签进行了修改。
有没有办法阻止这种类型的签到,或者至少让它们变得完全痛苦,以便我们可以自动阻止它们?
谢谢, 乔
My team uses SVN for our software platform, and we create tags periodically to help keep module versions straight. Best practice, as I understand it, is not to modify a tag once it has been created. However, it seems that sometimes the temptation is too great and a modification is made to one of the tags.
Is there a way to prevent these kinds of checkins, or at least make them a complete pain so that we can discourage them automatically?
Thanks,
Joe
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建一个预提交挂钩,如果标签已存在,它将拒绝提交。有关实现挂钩的更多详细信息,请参阅此处(请参阅实现存储库挂钩部分):
http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html
Create a pre-commit hook which will reject the commit if the tag exists already. More details on implementing hooks can be found here (see the Implementing Repository Hooks section):
http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html
我认为您正在尝试为非技术问题找到技术解决方案。在弄清楚如何处理这些签入之前,您必须先确定进行这些签入的原因。如果它们是在团队领导层批准的情况下制定的,那么任何流程都不会阻止它们将来发生。另一方面,如果这些检查是由自认为更了解的团队成员进行的,那么您就可以让领导层介入来解决流氓开发人员的问题。
只有在整个团队明确创建标签后的期望之后,您才能通过技术解决方案(如果需要)强制执行这些期望。
至于如何防止签入 - 在我看来,最简单的解决方案是创建标签后通过 基于路径的授权。但请注意,SVN 书籍的作者还明确声明了以下有关基于路径的授权:
Methinks you are trying to find a technical solution for a non-technical problem. You have to identify why these checkins are made before figuring out how to deal with them. If they are made with the approval of the team leadership, no amount of process would prevent them from happening in the future. If on the other hand these checkins are made by individual team members who thought they know better - well, then you get the leadership involved to solve the problem of a rogue developer.
Only after the whole team is clear on what is expected once a tag is created, you can enforce these expectations with a technical solution (if needed).
As for how to prevent checkins - seems to me that the simplest solution would be once you've created the tag to set the security on it to read-only for everybody through the path-based authorization. Note however, that the authors of the SVN Book also explicitly state the following about the path-based authorization: