[Lowerbounds, Upperbounds]

Algorithms are everywhere.

One nice feature of Subversion is its automatic end-of-line conversion capability. Regardless of what’s in the repository, you can ensure that files in your local working copy use the native EOL style.

That is, if you have it set up properly. :P

The trick is to use the properties feature of Subversion. For each file, Subversion allows us to attach a list of properties (key := value). Some properties have special meanings and svn:eol-style is the key that we are interested in today.

When the value of its key is set to native, Subversion will ensure that the file is in the native EOL style every time you update the file in your working copy. And when you check in the file, the conversion will happen automatically so that there are no accidents.

But isn’t it too tedious to have to setup this property for every file that you want automatic EOL conversion to apply? Well, this is when the Subversion local config file comes in.

The config file that I ask my fellows to use contains an auto-property section. Basically, Subversion allows us to automatically attach a property to files of any extension. For instance, to have all my TeX files to use native EOL:

*.tex = svn:eol-style=native

Lovely.

P.S. The auto properties are added when you add a file to version control. So, just replacing the config file will not affect the files that are already under version control. In that case, assuming you have the command line client, use

svn propset -R svn:eol-style native *.tex

to set the property on all TeX files (or other appropriate file types) in the current directory and its descendants.

No Comments :(