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

Re: Beautify code thru a hook

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2003-05-09 18:05:02 CEST

"Jean-Luc Wasmer" <jl.subversion@wasmer.ca> writes:

> ----- Original Message -----
> From: "Garrett Rooney" <rooneg@electricjellyfish.net>
>
> > >How can I filter committed files thru a code beautifier (like astyle)?
> [...]
> > what you could do is have a pre-commit hook that verifies that the code
> > being checked in conforms to the style guidelines, and if it doesn't
> > refuse to proceed with the commit. i don't know of anyone who's done
> > this, but it shouldn't be that hard.
>
> How can I send back the message "File doesn't comply to rule XYZ" to the
> client?

Make your pre-commit hook return exit code 1. I don't remember if you
can throw a specific error-message back, though.

> What about doing this in the post-commit hook. There wouldn't be
> any pbms with the client since the revision number would be
> incremented.

A post-commit hook would have to use svn_fs.h directly. You'll need
to be *very* careful that you don't accidentally trigger the
post-commit hook again, putting you into an infinite loop.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri May 9 18:06:44 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.