On Mon, Jun 9, 2008 at 6:54 PM, Tom Browder <tom.browder_at_gmail.com> wrote:
> There was a thread on enforcing code format prior to committing (in
> 2005) and I saw no real resolution.
>
> I have an interest in the same subject because I have to share code,
> via svn, with MS Visual C++ developers. Their IDE slings text files
> around like there is no control at all. The code is horrible when
> importing into xemacs. I have seen no such complaints here so there
> must be something my VC++ people are doing wrong (or I am: tabs vs.
> space control, or?).
>
> So the question is: how do you avoid gross text reformatting going
> between VC++ and "normal" *nix code editors (I use xemacs).
>
> Thanks for any suggestions or pointers.
>
> -Tom
>
> Tom Browder
> Niceville, Florida
> USA
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: users-help_at_subversion.tigris.org
>
>
Not super on-topic, but there is a slight subversion angle to my answer.
You could use a code reformatter - astyle (Artistic Style) is one I
like (runs on Windows and UNIX). You pick the formatting styles and
it reformats code (C, C++, C#, Java).
On the svn end: It's best to reformat all in one atomic commit. Eg.
when 'svn st' shows no changes, run atyle on one or more files and
then commit with 'svn ci -m "Ran astyle ...rest of command line..."
Try to discourage people from reformatting the code and then making
changes. It makes undoing those changes nearly impossible: the diffs
become a mess and it's very difficult to later see what code really
changed (vice the formatting).
You could also write pre-commit hooks to check that files are correct
--- reformat them and compare to the original, if they are not the
same, refuse the commit. I'm guessing that this will annoy most
people.
Of course, you can also set emacs up for format however you want.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-06-10 04:08:43 CEST