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

Re: Is it possible to test code before allowing it to be checked in?

From: Ryan Schmidt <subversion-2008c_at_ryandesign.com>
Date: Sun, 2 Nov 2008 19:35:11 -0600

On Nov 2, 2008, at 17:47, mindspin311 wrote:

>
> I want to be able to run a php syntax validater and phpunit tests
> before
> someone checks in code using pre-commit hooks. Is this possible?

Yes.

> I'm assuming it would be something like:
> * User checks in code
> * A unique branch is created including the checked in code
> * An ant script is then run which validates the entire code base
> * On success, the users code is then checked into the repository
> * On failure, a unique error is generated and code is blocked from
> being
> commited until it is fixed.
>
> I know everything can be done except for taking recent revisions
> committed
> to the trunk and automatically moving them to a dynamically created
> branch
> for a user. For that, I'm not sure if it is possible currently without
> making changes to the source code of subversion.
>
> So, what I really want to do is redirect a users changes to a
> dynamically
> created clone of the current trunk before authorizing the commit.

You don't need to (and, in a hook script, can't, at least not the way
you want to) create a branch for the code. Just run your code tester
on the files in the transaction, and if they don't pass, then deny
the commit.

Here's an example hook script you may be able to modify to your needs:

http://svn.haxx.se/users/archive-2006-06/0853.shtml

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-11-03 02:39:46 CET

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.