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

Re: Pre-Commit hooks and Code Format checkers.

From: Ryan Schmidt <subversion-2007b_at_ryandesign.com>
Date: 2007-12-01 08:27:22 CET

On Nov 30, 2007, at 10:57, Eric Berry wrote:

> I want to know if it's possible to insert a pre-commit hook that
> can check the incoming code against a formatter.

It is.

> My company actually wants to set it up to automatically format any
> code that comes in before it gets committed, but I know that the
> pre-commit hook isn't supposed to change the actual commit.

Right, doing so would screw up your committers' working copies so you
really shouldn't do that.

> From my understanding it's supposed to be more of a pass/fail
> check. If the commit is "valid" (for however many reasons) then the
> commit is allowed, otherwise it is denied.

Exactly. And you can print error messages to stderr, which will be
sent back to the client upon such a failure, and you can thereby
explain to the committer what they must change so their changes will
be accepted.

> Is this possible?

Yes, here's an example which checks the syntax of Java files:

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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Dec 1 08:27:54 2007

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.