On Nov 25, 2008, at 07:18, Robert P. J. Day wrote:
> On Tue, 25 Nov 2008, Giulio Troccoli wrote:
>
>> I've done a little test. I used dos2unix to change the EOL of a text
>> file, set the svn:eol-style property to LF and commit. You can't
>> have mixed EOL style when you set the property I seem to remember.
>> All this on a Unix system.
>>
>> Then I change the EOL style with unix2dos but svn status did not
>> report any changes.
>>
>> I'm not sure what this proves though. Maybe that once svn:eol-style
>> is set Subversion doesn't care anymore about the actual EOL, because
>> when you check the file out (or maybe even just an update) the EOL
>> will be what the property says.
>
> i just did a test as well, and it does what i was hoping for.
>
> 1) take a non-propertied text file, "unix2dos" it to get <CR><LF> EOL
> characters in it, use "svn diff" to see that, yes, they're there, and
> commit that.
>
> 2) use "svn cat" on the repo itself to verify that, yes, it got
> committed with the <CR><LF> EOLs. so far, so good.
>
> 3) check my working copy and, not surprisingly, the <CR><LF> EOLs are
> still in the file in my working copy.
>
> 4) "svn propset svn:eol-style LF" that file in my working copy, verify
> the property difference with "svn diff" and commit. commit succeeds.
>
> 5) "svn cat" the file in the repo to see that, sure enough, the EOLs
> have been reduced to simple <LF>s. which is what i was after.
>
> 6) note, with some surprise, that the file in my working copy has
> *also* been reduced to simple <LF> EOLs. curious. i would have
> thought that i would have had to update first but i'm good with that.
> so it looks like i can get the effect i want without having to resort
> to hook scripts.
>
> does all of that make sense?
For files on which you set the svn:eol-style property (to any value),
Subversion will convert their line endings to LF for storage in the
repository. When bringing the file into a working copy, it will
translate the line endings from LF to whatever the svn:eol-style
property says to do, and on commit, it will convert back to LF.
Users who change the line endings of a file with the svn:eol-style
property wholly to another line ending style will have no problem;
Subversion will convert it back to LF and accept the commit.
Users who change the line endings of a file with the svn:eol-style
property partially to another line ending style (e.g. some lines
ending with LF, some ending with CRLF; some fantastic Windows editors
like to do this) will encounter an error message from Subversion
telling them the file has inconsistent line endings; the user must
resolve this problem before committing.
Users can change the line ending style of files that do not have the
svn:eol-style property, either wholly or partially, and Subversion
will accept the bytes they send with no complaint. This is why you
should set up a pre-commit hook: to prevent people from committing
new files that do not have the property set.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-11-25 18:56:56 CET