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

Re: Formating C/C++ code before commit with indent

From: Russ Brown <pickscrape_at_gmail.com>
Date: 2005-06-21 15:11:59 CEST

Servico Tpd Rodrigo Alfonso Menezes Madera wrote:
>
>
>
> Dear Subversionists:
>
> Since I´ve notest the huge biological cluster that we have here, I am
> wondering if anyone has a ingenious way of solving this problem.
>
> All of our C/C++ projects follow a well defined format (wich can be
> represented via indent params) and we wish to run indent just before the
> commits. This is important because our programmers very different setting
> in their editors such as tab spaces and formatting styles. The indent
> program handles this ok. It just has to be executed before the commit.
>
> Right now we have a policy that explicitly tells the programmer to run the
> "prepare" script before the commit. But, naturally, people have made some
> mistakes.
>
> One way I though of doing this was to write wrapper scripts to the commit
> action, so the user would execute: SvnCommit instead of the command
> directly. The only thing is that this is quite anoying and doesn´t work
> with other plugins (unless you edit them, of course) like the Anjuta
> Subversion plugin.
>
> Also, many other actions would have to be wrapped.
>
> Any suggestions?
>

You could run the committed files against the formatter in the
pre-commit hook, and if they don't match the original file the user
didn't run the file through before committing, and you can reject the
commit. That would force the users to run the files through the
formatter first, though it wouldn't do it automatically.

> Thanks for the brainstorming,
> Rodrigo Madera
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Jun 21 15:14:25 2005

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