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

Re: update hook per project (or directory)

From: Ryan Schmidt <subversion-2007a_at_ryandesign.com>
Date: 2007-03-03 04:52:42 CET

On Mar 2, 2007, at 06:38, Andrew Brosnan wrote:

> On 3/2/07 at 9:42 AM, Jan Hendrik wrote:
>> Concerning Re: update hook per project (or dir
>> Andrew Brosnan wrote on 1 Mar 2007, 13:18, at least in part:
>>> The idea is to update the wc running a website, so only that one wc
>>> will auto-update. I was trying to avoid running svn up on the entire
>>> wc. when perhaps only a few files had been committed.
>>> Funnily enough, I started writing a script to do this using svnlook
>>> just as I got your response. Thanks Andy!
>> But consider what happens to your website if the svn update
>> execution fails for any reason
> the script needs to deal with that, i.e. - logging, error handling
>> or if there is another commit while
>> the script still runs
> ...hmmm, I don't know. The script just runs svn up. What happens if
> one
> user commits while another is running update? That should be OK.

If the post-commit hook just runs svn update on the server's working
copy, then the commit will not be completed until the update is done.
Therefore, nobody can commit while the update is running. That would
be a good thing.

If, on the other hand, you have written your post-commit hook script
to kick off the svn update process in its own thread and then return
control, then the commit will complete right then, before the update
is done, and another user could commit before the first user's update
is complete. Then the second user's svn update will fail because the
server's working copy will be locked, and your site will be missing
the second user's updates, until someone else commits something.

>> Guess this will be less of an
>> issue if repository and the website wc are on the same machine,
> one is, a mirror is not
>> but if they are not and you have to run the script through ssh/telnet
>> you might more easily end up with a wc lacking some updates.
> Not sure how. An update occurs after any commit. Seems like it
> should be
> OK.

svn updates are not atomic. It is possible that the update could fail
part of the way through, leaving you with a working copy that has
some updates in it, and is missing some others. This becomes much
more likely if the repository and the working copy are not on the
same machine, because then network issues can affect the update.

To reply to the mailing list, please use your mailer's Reply To All  
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Mar 3 04:53:08 2007

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.