SVN post commit hook - 查找已完成提交的文件夹
我们的存储库具有如下结构:
Dev
Project1
source
docs
...
Project2
source
docs
...
...
在提交对 Project1 源的更改后,我们希望部署 Project1(编译、测试、复制等)。如何在 post-commit-hook 中找到我们提交给 Dev/Project1 的信息,以便我们可以导出该项目并在其上运行一些任务?当提交到svn时(例如使用TortoiseSVN)ir被写为:“Commit to:...”如何找到“commit to”?
Our repository has a structure like this:
Dev
Project1
source
docs
...
Project2
source
docs
...
...
After we commit changes to Project1 sources we would like to deploy Project1 (compile, test, copy, etc.). How to find out in post-commit-hook that we commited to Dev/Project1 so we could export this project and run some tasks on it? When commiting to svn (e.g. using TortoiseSVN) ir is written: "Commit to: ..." How to find that "commit to"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该
在提交后挂钩中使用。 SVN 将提供 REPOPATH 和 REV 作为参数。
您将获得一个列表,其中包含所有更改后的路径(新行分隔)。然后您可以轻松地使用 grep 或其他任何东西来搜索更改的路径。
记住:启动一个新线程来构建/部署,因为 svn 将等待提交后挂钩完成(因此在部署所有内容之前您不会看到“已提交的修订 XX”)。
You should use
in a post-commit hook. SVN will provide REPOPATH and REV as arguments.
You get a list with all changed paths back(new line separated). You can then easily use grep or anything else to search for the changed paths.
Remember: start a new thread for building/deploying, as svn will wait until post-commit hook has finished(so you will not see "Committed Revision XX" until everything is deployed).
我建议使用持续集成服务器,例如 CruiseControl.NET 使用提交后挂钩来执行集成任务。
这些工具可以轻松地监视您的存储库中特定 URL 下的更改,但它们不必以与 Subversion 服务器相同的权限运行。特别是他们永远不会破坏您的存储库。您可以在任何(旧)服务器上运行它们,而您可以在更突出/稳定/备份的服务器上运行存储库。
I would recommend using a continuous integration server like CruiseControl.NET over using a post commit hook for integration tasks.
These tools can easily monitor your repository for changes below specific urls, but they don't have to be run with the same privileges as your subversion server. In particular they can never corrupt your repository. You can just run them on any (old) server, while you can run your repository on a more prominent/stable/backed up server.