SVN pre-commit hooks with perl tests

IvorW combobulus at xemaps.com
Thu Jan 12 13:09:29 GMT 2006



> -----Original Message-----
> From: muppet [mailto:scott at asofyet.org]
> Sent: 12 January 2006 02:26
> To: London.pm Perl M[ou]ngers
> Subject: Re: SVN pre-commit hooks with perl tests
> 
> 
> 
> On Jan 11, 2006, at 4:06 PM, Dominic Mitchell wrote:
> 
> > Looking at the pre-commit documentation there, you should be able  
> > to use
> > svnlook --transaction to see what's been checked in.
> 
> This still doesn't help you verify whether the tests succeed.  You  
> either have to pass that information in from the client (which can't  
> be trusted), or run the tests on the server.
> 
> Doing a checkout and build in a post-commit is not unthinkable,  
> though for performance reasons it is more desirable to merely  
> schedule a build in the post-commit, in case there are a whole bunch  
> piling up.
> 
> Doing a checkout, patch, build, and test in a pre-commit, whose  
> return code will be inspected to determine whether the commit may  
> continue, is going to be slow.  You can speed things up by keeping a  
> persistent sandbox and updating, but it will still incur a 
> noticeable  
> lag on the client side ("Why does svn seem to hang whenever i 
> commit?").

One option might be a "two phased commit". This would need multiple SVN repositories, probably controlled by SVK.

The commit request goes on to the "staging repository", where it is checked out to the testing sandbox, built, completes the test suite and is pushed to the "live repository" if all is OK. If the tests fail, the "staging commit" is undone.


More information about the london.pm mailing list