views:

2260

answers:

3

So, you are all ready to do a big SVN Commit and it bombs because you have inconsistent line endings in some of your files. Fun part is, you're looking at 1,000s of files spanning dozens of folders of different depths.

What do you do?

+3  A: 

Add a pre-commit hook which parses the file content and performs the munging of CRLF/LF/CR/etc for you before it's written to SVN.

OJ
A: 

You may consider using a command like Linux's dos2unix for the conversion. Being a Linux command, it is easy to use it in batch mode with scripts etc. I do not know whether there is an equivalent for other operating systems.

Yuval F
+17  A: 

I don't think the pre-commit hook can actually change the data that is being committed - it can disallow a commit, but I don't think it can do the conversion for you.

It sounds like you want the property 'svn:eol-style' set to 'native' - this will automatically convert newlines to whatever is used on your platform (use 'CRLF', 'CR' or 'LF' to get those regardless of what the OS wants).

You can use auto-properties so that all future files you create will have this property set (auto props are handled client-side, so you'd have to set this up for each user).

Cebjyre