Wednesday, 24 June 2009

Source Control and Diff software

For some time now I've been perplexed that most source control systems, although designed and built for source control, are actually nothing more than file control systems. You can put any sort of file in a source control system, and it is treated as a file. Yes, a file; not source code, but a file that might (might not) contain source code. We need this because there are so many different file types we need to store along with our source these days that it wouldn't make sense to only store code.

Some SCMs have special comparison programs that allow comparison of image files, not just text. That got me to thinking; when I use a VCS, I would like it to know that a source code file should be stored in a certain format. This would allow me to use tabs and Allman style, whilst other colleagues could use spaces for indentation, and K&R style. I suspect it would then either be a case of the SCM storing the code in the most efficient format and converting to user-style when the file is retrieved from the repository. This would still allow me to use my preferred text-based diff tool to compare code written by myself and others, without having to worry about extra blank lines and braces in the wrong place, tabs and space indentation. The focus would not be on code-representation, but the code itself.

I know some source control systems allow hooks to be put in place that would allow this to be done. If only I had, or could make the time to do this.

No comments:

Post a Comment