Using SVN post-commit hook to update only files that have been commited

Posted by fondie on Stack Overflow See other posts from Stack Overflow or by fondie
Published on 2009-01-15T12:15:26Z Indexed on 2010/06/03 18:14 UTC
Read the original article Hit count: 287

Filed under:
|
|

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.

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

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.

If committing the follow files:

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

It would update the directory: /branches/feature_x/

Can anyone help me create a solution that achieves this please?

Thanks!

Update:

  • The repository and development site are located on the same server so network issues shouldn't be involved.
  • CPU usage is very low, and I/O should be ok (it's running on hi-spec dedicated server)
  • The development site is approx. 7.5GB in size and contains approx. 600,000 items, this is mainly due to having multiple branches/tags

© Stack Overflow or respective owner

Related posts about svn

Related posts about hook