Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore coding convention/style while generating diff using svn?

How can we ignore coding convention while generating diff using svn?

To elaborate, I do not want to distinguish between the following two coding styles

while (variableIter.hasNext())
{
    lModel = variableIter.next();
}

AND

while (variableIter.hasNext()) {
    lModel = variableIter
   .next();
}

If I run a svn diff, I'll get the following diff:

 -            while (variableIter.hasNext())
 -            {
 -                lModel = variableIter.next();
 +            while (variableIter.hasNext()) {
 +               lModel = variableIter
 +               .next();

But I do not want this to be part of the diff. I'd like svn to ignore this kind of coding style differences. So, is there any option in svn which can help me do this? OR is there a script or something I could run on the svn generated diff to spit out only real changes and not the coding style changes?

TIA

like image 371
texens Avatar asked Nov 15 '22 01:11

texens


1 Answers

I don't know if svn has a builtin function to do that. Anyway you could use some tool to uniformily indent your code before submitting, like the indent tool for C (http://www.gnu.org/software/indent/).

Or you can try to launch the diff with this option: svn diff -x -w

like image 136
Heisenbug Avatar answered Dec 06 '22 14:12

Heisenbug