views:

116

answers:

2

Task at hand — I have three versions of some code, developed by different coders, one “parent” and two “child”, and need to calculate, which one is closer to the parent one.

Size of code at hand prohibits from manually counting diff's, and I failed to see any aggregate similarity stats in popular diffmerge tools I've tried.

Hao shot web^H^H^H^H^H^H^H acquire the single percent “similarity” number?

Thanks.

+3  A: 

You could count the lines of the diff. On Linux you would do:

diff -r parent child1 | wc -l

diff -r parent child2 | wc -l

This way you get a rough difference in lines of code.

Peter Stuifzand
+1  A: 

Perhaps you can use a Copy-Paste detector tool such as http://pmd.sourceforge.net/cpd.html. I haven't used it personally but it seems to be able to generate statistics.

gooli