I'm completely stuck with an SVN error when committing 2447 files at once. I'm using TortoiseSVN (latest version) on Windows 7 64bits.
The fact is that some files were created on Mac, and others on PC, so TortoiseSVN stopped the commit with an annoying Inconsistent line ending style
error.
In the beginning, to solve this problem, I manually opened the incriminated file in netbeans, added one blank space, removed it and saved the file so Netbeans converted properly all line ending chars, but it seems there's more than "some files" incriminated.
Of course I searched the web for a solution but I haven't found any suitable for Windows environment.
I'm currently banging my head against the walls.
Under Windows 7, you can use Notepad++ v5.6.8
to convert EOL
Edit --> EOL Conversion --> Windows / Unix / Mac
In Notepad++, select " View -> Show Symbol -> Show End of Line"
In the search box (Control-F) select the Regular Expression search mode and search for the string:
[^\r]\n$
(translation: \n without a \r before it).
This will bring you directly the problem line(s) where you'll see the line ending with LF rather than with the pair CR-LF
So I answer my own question with @assylias's answer :
You can capture the w:
(\w)\n$
and replace with$1\r\n
where$1
is the character.
Searching & replacing with Netbeans with this regex does the job.
Edit : my problem was that a custom script inserted wrong EOL chars (\n
instead of \r\n
) in these files)
If your line endings are all in order, it could be that your text file has a UTF16 Byte Order Mark (BOM).
You can fix that using Notepad++. Encoding -> Convert to UTF-8.
In Vim or GVim under Windows, the broken files all showed ^M
at the end of each line.
To fix it: :s/\r//g
to remove the broken extra line endings.
In relation to the post just above, actually the vim regexp should be :1,$s/\r//g
.
Another way on *n?x is using sed:
sed -i '-es/\r//g'
To solve the problem with different line endings, you can set the SVN property as follows:
svn propset svn:eol-style native my_file
Although this will solve the line endings problems and make merging easier, it will mean that blame will show the person adding the eol-style as the changer of all lines, and it also means that your working files will end up getting copied into temp folder when doing a diff.
The blame issue can be solved afterwards by doing this:
svn blame my_file -x "--ignore-space-change --ignore-eol-style"
What I did was open the project properties window by right-clicking the file explorer while browsing the repo I wanted to edit, then selected:
TortoiseSVN > Properties > New... > EOL > As is (no specific EOL).
来源:https://stackoverflow.com/questions/16730783/inconsistent-line-ending-style-nightmare