[postgis-devel] Astyle Bot

Chris Hodgson chodgson at refractions.net
Fri May 13 14:09:04 PDT 2011


I'm not sure if this is the 4th or 5th time this has come up...

svn hooks are not supposed to change the code that is being committed. 
The reason for this is that there is no way to communicate those changes 
to the client. The unformatted version of the code in your sandbox, 
after you commit, is revision X, and the version of the code which was 
automatically formatted and put in the repository is ALSO revision X. 
This causes future commits to potentially fail, and there is NO WAY to 
update your client because it thinks that everything is happily the same 
updated version as is in the repo.

We could do an automatic process to go in after an update and checkout 
any changed files, restyle them, and commit them, but then our SVN 
history is full of "restyle" commits. This causes confusion when looking 
for "who/what broke the build?" and generally just seems messy to me... 
comparably messy to just having an irregularly styled codebase.

What we could do is put a pre-commit hook in SVN that runs astyle and 
looks for changes - if there are any, then the commit is rejected, and 
you have to run astyle yourself before committing. However, due to the 
apparent lack of compatibility between versions of astyle, this doesn't 
seem to work either. Perhaps we could include a version of astyle or a 
similar script inside postgis? Similar to including autoconf-generated 
tools. Then we can ensure that the same formatting is being run on both 
the SVN server and all clients. I don't know whether this is possible 
with astyle or if there is another tool that could do it?

Not to start a holy war but I don't really have a problem with 
formatting in general. Compared to Mapserver, the PostGIS code looks 
great! But then, more developers == more differences. So anyways I'm 
pretty indifferent about the "solution" to this "problem".

Chris


On 13/05/2011 1:22 PM, Paragon Corporation wrote:
> +1
>
> Strk and Nicklas,
> But I thought we had this discussion and putting in an SVN hook or a smart
> Astyle bot was only in our dreams?  Is it possible?
>
> Thanks
> Regina
>
> On Fri, May 13, 2011 at 12:30:06PM +0200, Nicklas Avén wrote:
>
>> We run a lot of different jobs building documentation, building postgis
>> for regresstest and so on.
>>
>> Why is it a problem to run astyle somewhere in the chain too?
> +1 on this, let's have bots cleanup the code for us.
>
> --strk;
>
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel




More information about the postgis-devel mailing list