views:

135

answers:

2

Hi!

We're using CVS, on every release we have to synchronise two different branches of code, and in every release cycle it's the same story, whitespace problems causing errors and wasting time.

I'm looking for a way to automatically strip out trailing whitespace upon committing a file to CVS, unless explicitly forbidden, say by a command-line option. Is there a solution already available? If not, would anyone be interested if I wrote a plugin to do this?

Regards, Steven

A: 

Most source management tools have options to compare two files ignoring whitespace. Have you checked for this?

Ira Baxter
The propellerheads on our team have already tried various ways of solving the problem, which have already been integrated into our toolset. However, they are not perfect, and there are always edge-cases in our patching process that aren't solved by these measures. I feel that if we could trim trailing whitespace *upon commit*, it would solve 90% of our problems.
A: 

You could try using a compare utility like Beyond Compare which you can configure to ignore whitespace and other trivial differences between files. Or you could maybe configure the existing compare tool you're using to do something similar?

Darth Continent
Thanks, didn't know about this tool, will check it out to see if it helps.
If the problem is CVS insisting that the versions are different when it does the update, an external tool won't help. Your 'strip on commit' is the best option. You can put a trigger in CVSROOT/commitinfo, but you'll have to write it.
Colin Fine
That was my feeling. The primary problem is that there are two different versions in CVS, on different branches, that only differ by whitespace. Thanks for the tip, now I must motivate it. If I come up with anything I think will be useful beyond our environment, I will happily share it under an OS license. I'm sure we're not the only ones with this problem.
Could write a VBScript or something which would automatically iterate through the local repository and strip trailing whitespace just prior to your doing a commit, but that would probably not be the most elegant workaround. :-D
Darth Continent