Deployment Host: Ability to force line separator

Scenario: PyCharm running on Windows XP. Subversion checkout. Most files are created in Subversion with eol-style=native, which means when you checkout on Linux, you get LF line-endings, and a Windows checkout gets CRLF line-endings.

I'm "correctly" getting CRLF line-endings on my WinXP workstation.

PROBLEM is, my Deployment Host is a Linux server. PyCharm 2.6.2 seems to be doing an excellent job keeping changed files automatically uploaded (nice!) As you can imagine, the files end up on the Linux server with CRLF line-endings.

I know PyCharm settings for Code Style / General allow me to force LF for new files. Is there a way to force a line separator style per Deployment Host?
4 comments
Comment actions Permalink
For now, I'm manually fixing line-endings on the linux machine using:
Convert a tree of files from Windows line-endings to Unix line-endings
 > find . -type f -print0 | xargs --null dos2unix
prettyPrint(); This runs dos2unix on every file in the tree starting in the current directory. The extra bits in there allow this to work on files with spaces in the name.

Still looking for an automatic, PyCharm built-in solution of course.
0
Comment actions Permalink
It's not possible to configure the code style per deployment host, but it is possible to configure it per project. Go to Settings | Code Style, select the "Project" scheme and specify the settings you need.
0
Comment actions Permalink
Thanks for the helpful response. I have my project configured for Unix line-endings, but based on what I'm seeing, I think that only affects new files that I create. The files that are already checked out of my version control (Subversion) with CRLF line-endings remain with CRLF line-endings even if I edit and save them in PyCharm. This is probably the most correct thing to do–respect the existing line-endings.

Right now, I feel I have 3 likely avenues to solve the problem:

1. PyCharm feature to force specific line-ending per deployment host. (This seems like a good option to have.)

2. Force all the developers in my company to set the eol-style=LF property default in their Subversion config (so new files get created with this property), and write a script to force this property to all files in our repository (so existing files get this property). This should work assuming the few Windows-based developers we have would not have any issues with unix line-endings.

3. Force a dos2unix on my working copy after every SVN update. Currently I use Subversion integration within PyCharm to update. It does not appear that PyCharm will give me a hook where I can force a dos2unix pass. (I'm not suggesting PyCharm needs this.)
0

Please sign in to leave a comment.