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

Re: Automatic checkout of hook scripts under revision control

From: John Rouillard <rouilj_at_renesys.com>
Date: 2006-12-22 22:06:50 CET

On Fri, Dec 22, 2006 at 03:03:22PM -0500, Tim Bingham wrote:
> One question - how does your post-commit script handle the case that
> it's the post-commit script itself that's just been committed ?
> Doesn't this depend on the shell 'doing the right thing' when it
> executes the post-commit hook and "svn up" 'doing the right thing'
> when it updates the working copy of the post-commit hook?

Unix based shells/interpreters open the script file and keep it
open. So by Unix design, the original script file can be deleted
without affecting the script file that is open in the interpreter.
This isn't true under windows where you can't delete an in use file.

For shell's there is a possibility of corruption if the file is not
deleted and replaced but modified in place. A number of shells don't
read the entire file before execution, but execute as they read.

If that is a concern I would use a perl script as your post-commit
hook. It opens the file, parses it into an internal form, then
executes it from the internal form not from the original script
file. So modifications to the script file are ignored by perl. (I am
not sure if perl closes the file before it starts execution, it may
not so this won't solve the problem on windows.

When svn updates, it looks like it deleted the old file replaces it,
so no issues.

If you break the post-commit script, you just need to manually edit
the script in the repository, fix it and check it in.
 

-- 
				-- rouilj
John Rouillard
System Administrator
Renesys Corporation
603-643-9300 x 111
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Dec 22 22:07:25 2006

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.