On Mar 14, 2008, at 16:53, Scott Sharkey wrote:
> Ryan Schmidt wrote:
>> On Mar 14, 2008, at 12:54, Scott Sharkey wrote:
>>> Paul Koning wrote:
>>>>>>>>> "Edward" == Edward Harvey <Harvey> writes:
>>>> Edward> The ^M characters aren't added by svn, they're added by
>>>> your
>>>> Edward> text editor. Cross-platform editors such as vi, gvim,
>>>> emacs,
>>>> Edward> and xemacs won't do that. You can convert the file
>>>> formats
>>>> Edward> with "dos2unix" and "unix2dos"
>>>> Edward> I never would have guessed, but in the other replies so
>>>> far,
>>>> Edward> they say you can also have svn (or tortoise)
>>>> automatically do
>>>> Edward> the unix2dos or dos2unix for you. Essentially yes.
>>>> Take a look at svn:eol-style. As a rule of thumb,
>>>> this attribute should always be set (usually to "native") for
>>>> any text
>>>> file.
>>>> Values other than "native" are sometimes useful. For example,
>>>> we have
>>>> a nightly build machinery setup where a working directory is
>>>> checked
>>>> out on a Unix system, then copied or net-mounted from a Windows
>>>> system
>>>> that has to build some of the bits. The source files can be
>>>> "native",
>>>> because the Windows compilers accept Unix line endings in the
>>>> sources. But control files, like the "project" files, need Windows
>>>> line endings. So we set eol-style to CRLF for those.
>>>
>>> Paul: is there a way to make "native" the "default", or do we
>>> literally
>>> need to enforce it on every file when checked in?
>>
>> What you do is this:
>>
>> On every client, edit the Subversion config file and set up your
>> auto-props to automatically set this property to the desired value
>> on all files where that would be appropriate.
>>
>> Then, on the server site, write a pre-commit hook to reject
>> commits that do not match your policy.
>
> I was afraid you were gonna say that... Well, I guess I appreciate
> it.
>
> Unfortunately, that means I will end up doing a LOT of developer
> education, but I guess that's the price we pay. I wonder if I can
> develop a pre-commit hook to auto-set that property?
You can't modify the incoming transaction in the pre-commit hook. You
can only accept or reject it.
Build your developer education into the hook script. If you're going
to reject the commit, print a detailed message on stderr explaining
why the commit is being rejected and how the developer can set up
their environment to prevent this error in the future.
Don't forget to Reply All so your replies go to the list too, not
just to me.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-03-14 22:58:42 CET