Smart Tech for a better Web

SVN Properties - Client Config


You know I am working on several open source projects, and lately one of my colleagues told me I should stop coding asap and: "please correct your client configs I don't want to fix the stuff anymore". This shout made me think about my bad behaviour and to be honest, I didn't know why I should do this and how. After some research, I figured out that the most cool feature of the SVN properties is to ensure that if you check out something from repository, you'll get the line endings you need.

In other words, if a user on a Windows machine checks out a working copy that contains a file with an svn:eol-style{.literal} property set to native{.literal}, that file will contain CRLF{.literal} EOL markers. A Unix user checking out a working copy which contains the same file will see LF{.literal} EOL markers in his copy of the file.

Quoted from:

So, this is client config. That means YOU have to make sure that you add your files with the correct properties. Let's assume you want to add a file named test.txt. You would do:

svn add test.txt

After adding you need to perform:

svn propset -R svn:eol-style native test.txt

to set the properties correctly. Having that being said. most people will complain now that this is a difficult task and very error proven. Well it is. But you don't have to take care if you are sure that only one operating systems (means: one development environment) is set up. This is true for most projects I guess. If it is NOT the case, you can force your developers to create a default config setup. On windows it just some entries in the registry (please try this, I am not using Windows for open source stuff anymore), on Mac OS X and Linux the file ~/.subversion/config must be edited. In my case, this did do the trick:

enable-auto-props = yes

*.java = svn:mime-type=text/plain;svn:eol-style=native
*.css = svn:mime-type=text/plain;svn:eol-style=native

SVN told me, after I wanted to change properties to native, that my css files were binary, which this wasn't the case, of course! I couldn't change it, until my colleague came up with the following:

svn pl -v


Properties on 'maven.css':

He further told me to do:

    svn pd svn:mime-type maven.css

And that was it - SVN is forced to use mime type I want. Last but not least, here is the link to the apache recommendation or SVN config.

Tags: #SCM #OS X #SVN




When you load these comments, you'll be connected to Disqus. Privacy Statement.