[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: Steve Williams <stevewilliams_at_kromestudios.com>
Date: 2006-12-21 22:42:54 CET

John Rouillard wrote:
> I keep my SVN hook and conf files under /SVN (/SVN/hooks and /SVN/conf
> respectively) in the repository and use:
>
> # check out/update SVN control files if needed
> if svnlook -r $2 dirs-changed $1 | grep '^SVN/' > /dev/null; then
> echo "Updating repository control files." >&2
> cd $1/hooks
> output=`svn up 2>&1`
> if [ $? != 0 ]; then
> echo "svn update of hooks config files failed: $output, $!" >&2
> fi
>
> cd $1/conf
> output=`svn up 2>&1`
> if [ $? != 0 ]; then
> echo "svn update of conf config files failed: $output, $!" >&2
> fi
> fi
>
> in my post-commit script to update them. My hooks and conf dirs are
> svn working copies created using an in place import, but they could be
> normal svn checkouts as well.
>
> No problems so far with dozens of commits to the hook and config
> files.
>

Note for any Windows users who may try to do the same thing with batch
files. Updating and changing the batch file that is currently being
executed as the post-commit hook will cause strangeness and errors.
This is because cmd.exe does not take a copy of the batch file before it
starts executing it. It opens the batch file, reads a line, closes the
file, and executes that line. Then it opens the file again, reads the
next line from the byte position where it finished reading the previous
line, closes the file and executes the line. If you change the file
under its nose, the read of the next line may start halfway through one
of the new lines, therefore resulting in a partial line being read from
the file and the resulting strangeness as cmd.exe tries to execute the
line fragment.

Just something to note.

-- 
Sly
This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Dec 21 22:43:43 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.