[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: Mark Eichin <eichin_at_gmail.com>
Date: Mon, 3 Nov 2008 00:33:31 -0500

Another useful trick, if you're writing your own check/lint tools, is
that you can use svnlook the same way that example does to check out
the checker script too, so it's always a "live" version (requires some
caution, but we've found it useful.)

On Sun, Nov 2, 2008 at 8:35 PM, Ryan Schmidt
<subversion-2008c_at_ryandesign.com> wrote:
>
> 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
>
>

-- 
_Mark_ <eichin_at_thok.org> <eichin_at_gmail.com>
---------------------------------------------------------------------
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 06:34:00 CET

This is an archived mail posted to the Subversion Users mailing list.