SVN 提交后挂钩使提交速度非常慢 - 如何修复?
我向 Windows 2008 服务器上的存储库添加了一个提交后挂钩。因此,每次提交某些内容时,我都会 cd 到我的应用程序文件夹并运行svn update。这可行,但速度非常慢,并且 TortoiseSVN 直到提交后挂钩完成后才完成。我怎样才能让它更快?一种方法可能是不 cd 到任何应用程序,而仅到发生提交的应用程序。我怎样才能知道哪个应用程序获得了提交?一些正则表达式和 $1?我只尝试了一个应用程序,单个文件仍然需要 1.5 分钟,太长了。
谢谢
I added a post-commit hook to my repository on a Windows 2008 server. So every time something is committed, I cd to the folder of my apps and run svn update. This works, but its extremely slow and TortoiseSVN does not finish until the post-commit hook finished. How can I make this faster? One way might be to not cd to any app, but only to the one where a commit took place. How could I figure out, which app got a commit? Some regex and $1? I tried only one app and its still1.5 minutes for a single file, way to long.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会将提交与更新完全分离,就像(据我所知)持续集成服务器所做的那样。让 cron 每 X 分钟触发一次应用程序更新。这样,提交时间就不会受到任何影响。
I would decouple the commit from the update completely, like (AFAIK) continuous integration servers do. Have a cron trigger an update every X minutes on your apps. This way, the commit time will not be impacted at all.
删除 Subversion 挂钩并查看 Jenkins。 Jenkins 是一个持续构建服务器,但它的作用是在 Subversion 中完成提交后运行一个进程。通常,这可以是一个构建,但也可以在您的服务器上运行 Subversion 更新。
Jenkins 将记录所有内容并通知您(通过电子邮件、推文、即时消息,甚至 交通灯)当出现问题时。
很容易看到更改、历史记录等。此外,它不会减慢 Subversion 的速度。
顺便说一句,我推荐以下过程:
C:\inetd\www
运行。C:\inetd\www2
的新目录,然后对该目录执行svn export
操作。C:\inetd\www2
重命名为C:\inetd\www
。您可能必须退回您的服务器。这样做的目的是确保您的服务器永远不会在其目录中的某些文件版本为 2000 而其他文件版本为 2001 的情况下运行。这样,您的所有更改都会同时完成。另外,您并没有到处都有这些
.svn
目录(尽管 Subversion 1.7 客户端对此进行了相当多的改进)。Remove the Subversion hook and take a look at Jenkins. Jenkins is a continuous build server, but what it does is run a process after a commit is done in Subversion. Normally, this can be a build, but it can also be running a Subversion update on your server.
Jenkins will log everything and notify you (via email, tweet, IM, or even traffic light) when something goes wrong.
It's easy to see the changes, the history, etc. Plus, it doesn't slow down Subversion.
By the way, I recommend the following process:
C:\inetd\www
.C:\inetd\www2
and do asvn export
to that directory.C:\inetd\www2
toC:\inetd\www
. You might have to bounce your server.What this does is make sure your server is never running where some files in its directory are at revision 2000 while others are at revision 2001. This way, all of your changes are done at the same time. Plus, you don't have all those
.svn
directories all over the place (although Subversion 1.7 client has improved this quite a bit).