Friday, April 15, 2011

How do I diff 2 source trees with a difference threshold?


I have 2 source trees, one is very similar to the other (one is VC6 and one is VS2005). I need a program that can recursively diff the source trees and tell me which files are different.

However I want to be able to define 'how different' the files are. So I want to be able to ignore all files that are less than 5% different. I'd also like to be able to vary the difference threshold.

Does anyone know of such a tool?

Cheers Rich

From stackoverflow
  • I think the Linux kernel hackers use diffstat, IIRC.

    Rich : thanks, any idea for a windows solution?
    Bluebird75 : You can find a windows version of diffstat on cygwin.
  • The cross platform Eclipse editor has a good diff functionality. You can select any two folders and performance recursive diff, traverse through each of the change and merge if you want.

    However it does have the "how different" functionality you ask for. For "how different" feature one option would be diffstat as ashawley said. You can install cygwin and run diffstat on cygwin.

  • You could try Beyond Compare. I've found this very flexible in the past.

  • I don't think you can get a packaged solution to do exactly what you want, but you can use two different approach to solve the problem.


    Run diffstat on the two tree, then use a small shell script to extract the filenames that have more of 5% difference and then use a full diff on those files.

    WinMerge and your eyes.

    WinMerge is quite good and flexible (and free) for this, but I doubt that you can teach him to do the 5% thing. Still, you can see a recursive difference between two directories and you can teach him to ignore lines with RegExp.


Post a Comment