[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-07 04:49:09 CET

On Mar 6, 2007, at 06:30, Jan Hendrik wrote:

>> 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.
> Except if it happens to be a big commit/update, might block others
> from committing for quite some time. If the post-commit hook
> updating the server's working copy hangs, e.g. network problems,
> probably forever, till someone goes in and kills the process.
>> 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.
> Not familiar with threads, but I suppose it would be the same
> thread as long as the post-commit hook script does the work itself.
> But if it is just a wrapper for the actual script, e.g. post-
> commit.bat
> calling server-update.py, then this would run in a different thread,
> right?

Maybe threads isn't the right word. But what I meant to say:

Anything you do just in the post-commit hook, or any script the post-
commit hook calls, or any script called by such a script, and so
forth, is fine.

However, if you fork off a new process (create a thread, whatever),
then that is a separate process and the post-commit hook itself can
end before the forked process does, and that's when problems as
described above can start.

So, by (Unix) example (since I don't know Windows):

If my post-commit hook is...

/path/to/some-other-script.sh "$REPOS" "$REV"

...then everything is fine, because post-commit will wait for some-
other-script.sh to finish before it finishes.

However, if my post-commit hook is...

/path/to/some-other-script.sh "$REPOS" "$REV" >/dev/null 2>/dev/null &

...then some-other-script.sh has been forked off into its own
process, and post-commit ends immediately, before some-other-
script.sh is done running, which can cause the possible problems as
mentioned above.

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 Wed Mar 7 04:49:37 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.