Line Terminator Questions

Hi,

I have an issue that I thought someone might be able to help with. Our project has developers that work on both Unix and Windows. When a new Java file is created in IntelliJ on windows, then checked into CVS by Intellij, when a developer checks it out under Unix, it has CNTL-M at the end of every line. When I create a new Java file under Cygwin Emacs and check it in, we get no CNTL-M in the file. Can anyone help me out ?

Thanks

6 comments
Comment actions Permalink

This doesn't help, but that's actually correct behaviour, and there's a slight case that says that emacs is wrong!

Basically, the eternal problem with line endings is that different systems used different ones. Windows uses CR,LF; Macs traditionally use a single CR, and Unix systems a single LF.

More practically, you'd need to see if there's some way to automatically convert from one to another as part of the CVS processing, for instance. I'd have thought it's not going to be an uncommon problem, but you need to be looking outside a purely IntelliJ solution, I expect.

You could use ant to cvs update and then convert the files (it's got a task to do the conversion) but you should be able to find something better...

0
Comment actions Permalink

Just noticed in the 661 build at least, there's a "Line Seperator (for new files)" setting in the IDE Settings/Code Style/General dialog.

0
Comment actions Permalink

There is a feature to change the line terminator characters for NEW FILES, but not when editing current files (at least I can't find it!)

The problem is we have developers working in both Unix & Windows. The windows developers checkout the code using Unix CVS and then access the files via a Windows Drive mapping and edit using windows intelliJ IDEa.
When checking in they use Unix CVS again.

Unfortunately a problem arises because the files were created with windows '\r\n' terminators and checked into CVS as is (Unix CVS doesnt strip off the extra '\r'

We are moving to complete CVS integration in IntelliJ, however now when I check out those files WinCVS adds an extra \r to all the lines giving double spaced text files.

Solution:
I need the feature where I can save edited Windows(\r\n) files as Unix(\n). So that when they save the old (\r\n) files and check them in they will be stripped properly.

Hope I have made some sense in those ramblings!

Summary: Need feature "Save as Unix format not only for new files."

Regards,
Spencer

0
Comment actions Permalink

The correct solution is to configure your cvs to do the conversion. In our company sources have CR-LF line endings when checked out in Windows, and LF endings when checked out in Sun Solaris. This way the files can be modified by any editor not only IntelliJ IDE.

This conversion is probably done by the cvs client, but I'm not sure. Try reading cvs docs to see how this can be done.

0
Comment actions Permalink

The correct solution is to configure your cvs to do the conversion.


Yes, this shouldn't be done in idea. Also, any manual solution (choosing the
eol format on save) is very error prone.

Set a script in the server call tr when commit is done on text files.

Or, (harder?) alias cvs to always call tr (on text files) before doing the
commit.



0
Comment actions Permalink

If you are using Ant, its FixCRLF task
<http://jakarta.apache.org/ant/manual/CoreTasks/fixcrlf.html> may serve.

Kendall

"Carlos Costa e Silva" <carlos@keysoft.pt> wrote in message
news:arln8f$n4p$1@is.intellij.net...
>

The correct solution is to configure your cvs to do the conversion.

>

Yes, this shouldn't be done in idea. Also, any manual solution (choosing

the

eol format on save) is very error prone.

>

Set a script in the server call tr when commit is done on text files.

>

Or, (harder?) alias cvs to always call tr (on text files) before doing the
commit.



0

Please sign in to leave a comment.