Thanks Giulio!
I might have to steal your script. It's too bad they don't have this as a server-side feature.
Fu-Tung
--- On Mon, 9/8/08, Giulio Troccoli <Giulio.Troccoli_at_uk.linedata.com> wrote:
> That's not totally true. It'd be better to say that
> it's not advisable to do so. However it is
> "technically" possible and I have implemented it
> (and exactly for the OP's issue).
>
> My post-commit hook checks for the svn:eol-style. If
> it's not defined then it sets it to LF. If it defined
> but it's not LF then it changes it to LF. Finally a
> commit is done. To do all this I use a special
> "admin" working copy I keep on the server.
> I've never had any problems with that so far.
>
> This is an extract of my post-commit hook (it's a Korn
> shell script)
>
> ##
> ## MAKE SURE THAT THE svn:eol-style PROPERTY IS SET TO LF
> ##
> cd $WC_ADMIN_PATH
> $SVN --quiet update src
>
> # Set the flag
> propset=0
>
> $SVNLOOK changed --revision $REVISION $REPOS_PATH | $AWK
> '{OFS=";"; print $1,$2}' >
> $TMPDIR/changes_list
> for line in `cat $TMPDIR/changes_list`; do
> status=`$ECHO $line | $CUT -d";" -f1`
> file=`$ECHO $line | $CUT -d";" -f2`
> # If the file is a new file
> if [ "$status" == "A" ]; then
> # Set the svn:eol-style property to 'LF'
> $SVN propset svn:eol-style "LF"
> $WC_ADMIN_BASE_PATH/$file
> propset=1
> # Send an email that a new file has been added
> $MAIL -s "New file in Subversion: $file"
> $BUILDMASTERS_EMAILS
> elif [ "$status" == "D" ]; then
> # Send an email that an old file has been deleted
> $MAIL -s "Old file in Subversion has been
> deleted: $file" $BUILDMASTERS_EMAILS
> else # If it's not a new file and it's not been
> deleted
> # Get the svn:eol-style property, which is the one we
> are interested in
> eolstyle=`$SVN propget svn:eol-style
> $WC_ADMIN_BASE_PATH/$file`
> # If svn:eol-style is not 'LF' then change it
> if [ "$eolstyle" != "LF" ]; then
> $SVN propset svn:eol-style "LF"
> $WC_ADMIN_BASE_PATH/$file
> propset=1
> fi
> fi
> done
>
> # Remove the temporary list of changes
> rm -f $TMPDIR/changes_list
>
> # If we have modified some properties then commit the
> changes
> if [ $propset -eq 1 ]; then
> cd src
> $SVN commit --message "OOP: Setting (or changing)
> svn:eol-style property to 'LF'"
> fi
>
> Giulio
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-09-08 18:34:31 CEST