Wednesday, January 5, 2011

SVN Rant - Why is there no global "don't expand keywords" setting

After getting fed up with SVN's disgusting "merge" facilities, I ended up coding (and am still working on) Duality SVN which will eventually work around having to use them. But today, I'm getting fed up with the lack of a way to disable the "keyword expansion" facilities...

A little background info for the uninitiated
"Keyword expansion" is a feature from the old CVS (an old and nasty version control system that was widely used before SVN, which SVN tried to 'fix' the main flaws of) days. Inside your source files, you could write a line
(usually within some comment) which the version control system would expand to something like
$Id: gpencil_paint.c 34055 2011-01-04 06:28:44Z aligorith $
within your "working copy" (i.e. a copy of the file that your perform your editing/coding in) upon checking out or committing the file, but the server copy would only ever see/store a copy with the un-expanded keyword.

Now, apparently by default SVN will NOT perform this type of expansion unless it is told to do so. How? Well, every file that has this keyword expansion performed will have it's "svn:keywords" property set with a space-delimited list of tags to expand for that file.

What's the problem then?
The problem it turns out, is that with Blender's code base, most if not all all source files not only have the $Id$ lines, but, more damningly, have the svn:keywords property set.

The result is that everytime upon committing files (in particular), you are forced to reload the files in your texteditor afterwards as the keyword expansion means that the file will have been written over by some other tool.

This is not actually terribly nice. If it's just one or two files once in a while, then maybe that is acceptable. Unfortunately, this is multiple files, many times a day, needing to be reloaded.

Possible solutions...
I've tried making my text editors just silently reload files instead of prompting me to reload them. But that turned out to be really dangerous, and unstable, and a whole host of other issues...

Another (ultimate) solution would be to remove these svn props and the associated lines from the source files. Personally I'm strongly in favour of doing without these, and so I purposefully leave these things out from all new files I create in any projects these days. Unfortunately, it seems there are still some people who are a bit in love with having these properties around that they've probably written a batch script that runs after every svn commit has been made in trunk, checking if props are missing, and adding them if they are... :P

Since this probably won't be happening, I was hoping that there was some SVN option to ignore whether the svn:keywords properties were set or not, and just never expand those blasted keywords. However, after searching for ages, it appears that this option simply doesn't exist :(

Hacking time again...
Unless some other option comes along, I may just have to resort to doing some SVN config-file hacking to get things my way again.

I could've tried deleting all these svn:keyword props from my local copy via the standard methods, though doing so means that I risk accidentally committing this at some point (and then having the changes reverted, and so being forced to put this back in). Actually, that wouldn't even work, unless there's an option to ignore changes to SVN properties outright when getting files for performing SVN ops on. Then there are still problems when trying to actually change some SVN properties that I actually want to change...

Failing all this, I'm probably left with no option but to download the SVN sources, and edit+compile a custom version for myself. But then again, at least with (or thanks to the power of) open source software I can still actually do that :)

No comments:

Post a Comment