使用SVN提交后挂钩仅更新已提​​交的文件 [英] Using SVN post-commit hook to update only files that have been committed

查看:91
本文介绍了使用SVN提交后挂钩仅更新已提​​交的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将SVN存储库用于我的Web开发工作.我已经建立了一个开发站点,其中包含对存储库的签出.

I am using an SVN repository for my web development work. I have a development site set up which holds a checkout of the repository.

我已经设置了SVN提交后钩子,以便无论何时对存储库进行提交,都会更新开发站点:

I have set up an SVN post-commit hook so that whenever a commit is made to the repository the development site is updated:

cd /home/www/dev_ssl
/usr/bin/svn up

这可以正常工作,但是由于存储库的大小,更新需要很长时间(大约3分钟),这在进行常规提交时相当令人沮丧.我想要的是更改提交后挂钩,以仅更新已提​​交的那些文件/目录,但我不知道如何执行此操作.更新最低的公共目录"可能是最好的解决方案,例如

This works fine but due to the size of the repository the updates take a long time (approx. 3 minutes) which is rather frustrating when making regular commits. What I'd like is to change the post-commit hook to only update those files/directories that have been committed but I don't know how to go about doing this. Updating the "lowest common directory" would probably be the best solution, e.g.

如果提交以下文件:

  • /branches/feature_x/images/logo.jpg
  • /branches/feature_x/css/screen.css

它将更新目录:/branches/feature_x/

It would update the directory: /branches/feature_x/

任何人都可以帮助我创建实现此目标的解决方案吗?

Can anyone help me create a solution that achieves this?

更新:

  • 存储库和开发站点位于同一服务器上,因此不应涉及网络问题.
  • CPU使用率非常低,并且I/O应该没问题(它在高规格专用服务器上运行)
  • 开发地点约为. 7.5GB大小,大约包含600,000个项目,这主要是由于具有多个分支/标签

推荐答案

您可以使用 svnlook dirs-changed svn up -N 来仅更新每个已更改文件夹的内容:

You might use svnlook dirs-changed and svn up -N to update only the contents of each folder changed:

cd /home/www/dev_ssl
svnlook dirs-changed [REPOS] -r [REV] | xargs /usr/bin/svn up -N

或者,如果每个文件可能更适合您(使用sed去除动作字符):

Or, if per-file might be better for you (using sed to strip action characters):

svnlook changed [REPOS] -r [REV] | sed "s/^....//" | xargs /usr/bin/svn up

这篇关于使用SVN提交后挂钩仅更新已提​​交的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆