convering newline format to import to svn

imajeff wrote on Saturday, December 16, 2006:

Is Richard keeping FreeRTOS in Subversion now? I remember some consideration long ago. If so, I’m assuming the source code is stored as binary instead of text/plain, because of the following errors.

I have just tried importing the latest (4.1.3) to my svn repository using auto-props. The problem is that it does not try to guess when finding a text file with mixed newline formats, and stops the importing process.

It is easy enough to fix once I find each file (the tedious part is finding each file, and what format it should be). I convert it using utilities `dos2unix` or `unix2dos`.

For anyone wondering what this “newline” problem is all about, I’ll explain: SVN can distinguish ASCII text files from binary (using extensions such as .c or .h), and store text files in a universal form. The advantage is that when anyone checks out files, the source will be converted automatically to the standard newline form for the OS. The developer can then easily view/modify any files without the limitations I’ve had to continually deal with.

To describe the problems found, I use these terms:
DOS text format line ends shown "\r\n" meaning [CR LF]
UNIX text format line ends shown "\n" meaning [LF]

svn: File ‘FreeRTOS/Demo/lwIP_MCF5235_GCC/web.h’ has inconsistent newlines
- This file has an orphan ‘\r’ mid-line, the rest DOS format
000006f0 “\n#endif  /* \r */\n\n” [EOF]

svn: File ‘FreeRTOS/Demo/MicroBlaze/main.c’ has inconsistent newlines
- This has one ‘\n’ by itself, the rest DOS format
0001b00 “\r\n   \treturn 0;\n}\r\n/*-----------”

svn: File ‘FreeRTOS/Demo/uIP_Demo_IAR_ARM7/uip/fsdata.c’ has inconsistent newlines
svn: File ‘FreeRTOS/Demo/CORTEX_LM3S102_KEIL/include/pdc.c’ has inconsistent newlines
- These end with “\r\n”, the rest UNIX format “\n”

svn: File ‘FreeRTOS/Source/portable/MPLAB/PIC18F/port.c’ has inconsistent newlines
- This had “\r\n\n” which I converted to “\r\n\r\n”

nobody wrote on Saturday, December 16, 2006:

See here:

I have complained about the mixed format thing before.  The problem is caused by the number of target environments that are supported.  Some use Unix format some use DOS format even when the app is a windows app.

I use SVN to store a local copy also and have not had any problems.  It sounds like you have a more sophisticated setup than my basic installation.

I use Programmers Notepad to convert the format.

nobody wrote on Monday, December 18, 2006:

From the SVN change log:

Version 1.4.1
- NEW: TortoiseMerge can now handle files with CR lineendings. (Stefan)

Maybe this help?

imajeff wrote on Monday, December 18, 2006:

Thanks Anonymous-1 for that link. I had not seen it mentioned anywhere on, and had not really used sourceforge/veiwvc before, but I like it.

BTW there is no problem using any file that is in _either_ DOS _or_ UNIX format (I wasn’t sure about mac). The only problem is that some real lazy developers (mostly MS based) are careless and create a file with “mixed” newline formats. In other words, it is undefined which style of newlines it is. There was no apparent excuse for the twisted editor(s) to do it. It makes it not practical for svn to assume that the file is even a text file at all, so SVN chokes.

The ONLY thing that helps is to filter each source file and convert to a "valid" newline format. It does not matter which one.

I have corrected these from the latest release (4.1.3), and wonder if Richard or somone would try editing them with their corresponding editors, and see if it messes them up again. If there was a reason an IDE keeps messing one up, then it should still be considered binary and not text/plain.

imajeff wrote on Monday, December 18, 2006:

Anonymous-2, I doubt that you are looking in SVN changelogs, and that is not what I am talking about anyway, thanks. TortoiseMerge is not even part of Subversion. In fact I won’t be using the Tortoise stuff because they are still Microflop-only  :open_mouth:

I think you Anonymous guys really got to pull your heads out of the sand and make unique nicknames for yourselves  :slight_smile:
Maybe some of you don’t log in because when bookmark this forum directly it doesn’t remeber you. The solution is you just got to bookmark “” and it will remember you. From there, store all your favorite sourceforge forums. With that, I don’t have to keep entering login info, AND other people can identify my posts up front.