[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Hooks

From: David Weintraub <qazwart_at_gmail.com>
Date: Fri, 17 Oct 2008 17:32:35 -0400

On Fri, Oct 17, 2008 at 5:15 PM, Ravi Gehlot <ravi_at_ravigehlot.net> wrote:
> Can I use hooks to invoke an update when there is a commit on a repostiory
> when the code and repo are on differnt servers (same network)?

A post-commit hook can be made to do just that. There has been several
discussions on this very list about that type of hook. An easy way is
to have the post-commit hook pass the svn update command as an
argument to the "ssh" command. There are a few gotchas you do have to
watch for:

* Subversion doesn't complete the commit until the post-commit hook is
done. Actually, the commit is completed, but the user doesn't have any
way of knowing that because their command line client is waiting for
the post-commit hook to return. To get around this issue, put the
actual update in background in side the hook. That way, the user
doesn't have to wait for the hook to complete.

* You don't want to update a live webpage because at some point it
will be unstable with 1/2 of the files being updated, and the other
half being obsolete. A recommended strategy is to have your Apache
root as a symbolic link pointing to the directory that contains the
web content. You do a "svn export" to a new directory, then change the
symbolic link to point to that directory.

Personally, I am a bit weary about auto-updating webpages on every
commit. My preference is to put the actual web page on a branch.
Updating the trunk doesn't update the webpage, but allows you to do
packaging and testing. Maybe the latest check in is not a good idea.
After testing, you can post to the web-page branch which will update
the webpage.

This way, you have a bit more control over the webpage updates. I use
to do the updates via a crontab instead of using the post-commit
update hook. I would have the crontab run at a particular time during
the day. This allowed me to take down the website for maintenance
before I did the update, and made sure I didn't confuse any of my

David Weintraub
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-10-17 23:32:59 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.