使用 SVN post-commit hook 只更新已经提交的文件 [英] Using SVN post-commit hook to update only files that have been committed

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

问题描述

我正在使用 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 post-commit 钩子,这样每当提交到存储库时,开发站点就会更新:

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 分钟),这在进行常规提交时相当令人沮丧.我想要的是更改 post-commit 挂钩以仅更新那些已提交但我不知道如何执行此操作的文件/目录.更新最低公共目录"可能是最好的解决方案,例如

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-changedsvn 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 post-commit hook 只更新已经提交的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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