You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ryan Schmidt <su...@ryandesign.com> on 2007/12/01 07:27:22 UTC
Re: Pre-Commit hooks and Code Format checkers.
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