On Wednesday 22 March 2006 09:14 am, Chris Cannam wrote:
> What's the easiest way to untabify all the existing files? Is there any
> way to do this on commit, at the SourceForge side?
How about a Perl script that just slurps a file and replaces \t with 8 spac=
characters? My Perl syntax is too rusty to recall how to do it offhand, but=
it seems to me to be only about 5 or 10 lines of code.
Put it in a bash script:
for i in $(find $1 -regex ".*\.\(h\|cpp\|C\)$" ); do
=A0=A0=A0=A0=A0=A0=A0=A0perl tabs_to_spaces.pl "$i"
Run on top-level directory:
%>sh tabs_to_spaces.sh rosegarden
Have you looked at the astyle documentation? I thought it had an option=20
somewhere to do nothing but convert tabs to spaces. If so, just put astyle =
the bash script.
Trying to do it on an svn commit won't work as far as I know. But you can t=
it to reject commits that have tabs through a hook script (an even simpler=
perl script than tabs_to_spaces). From the documentation, actually modifyin=
the files to be committed through a hook script isn't recommended. That nee=
to be done on the machine of the one making the commit.
Server-side reformatting would require a wrapper program, so that "commits"=
are actually to the wrapper and not directly to svn. SF doesn't have this=20
capability, so everything needs to be done client-side.
Then again, I suppose you could have some sort of post-commit hook script=20
server-side that would initiate a checkout, run a reformatting script on=20
everything, and commit.