How to ignore convention / coding style when creating diff using svn?

How can we ignore the coding convention when generating diff using svn?

To develop, 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 svn diff, I 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 diff. I would like svn to ignore such differences in coding style. So, is there any option in svn that can help me do this? OR is there a script or something that I could run on the generated svn spread to spit out only real changes, not coding style changes?

TIA

+4
source share
2 answers

I do not know if svn has a built-in function for this. In any case, you can use some kind of tool to evenly indent the code before submitting it, for example, the indentation tool for C (http://www.gnu.org/software/indent/).

Or you can try running diff with this option: svn diff -x -w

+1
source

I cannot help with diff created directly by subversion.

But as soon as you understand what differences you see related to formatting, you can move on to an alternative to great tools. See our Smart Differencer tools. These tools are language dependent. They work by analyzing the language and building abstract syntax trees, and then comparing the trees. This makes them completely whitespace (and commentary) insensstitive; reformatting the code does not show up as a difference. Diffs are reported as language elements (operand, expression, operator, declaration, block, method, class, etc.) And editing actions (move, delete, insert, copy, rename-variable-inside a block and the exact beginning of a row / column and end row / column.

Currently we have SmartDifferencers for many languages, including C, C ++, C #, Java, JavaScript, PHP.

0
source

Source: https://habr.com/ru/post/1343596/


All Articles