使用 SVN 预提交挂钩来防止开发人员忘记 svn 添加特定的新创建文件的方法
有没有什么好方法可以使用 svn 预提交挂钩等来防止开发人员忘记添加文件?具体来说,如果用户有一个本地未版本控制的文件,其路径/文件名与某个正则表达式模式匹配(在这种特殊情况下为rails数据库迁移),我希望提交失败。用户教育(在提交之前始终运行 svn status 和 svn diff)、羞辱等迄今为止已被证明不足以防止此类问题偶尔发生,
Is there any good way to use svn pre-commit hooks etc. to keep developers from forgetting to add a file? Specifically I would like the commit to fail if the user has a local to them unversioned file whose path/filename matches a certain regexp pattern (in this particular case rails database migrations). User education (always run svn status & svn diff before committing), shaming, etc. has so far proven insufficient to prevent these sorts of problems from occasionally occurring,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(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.
预提交挂钩是在服务器端实现的,所以不需要。有一些客户端(例如 TortoiseSVN)允许在客户端进行提交挂钩,但这不是标准的。正如 Chris Kaminski 所建议的那样,您确实应该通过使用 CI 服务器来使构建失败来完成此类操作。
Pre-commit hooks are implemented on the server side, so no. There are some clients, TortoiseSVN for instance, that allow commit hooks on the client side, but this isn't standard. You really should be doing this kind of thing by failing the build with a CI server, as Chris Kaminski suggested.