2

Possible Duplicate:
Any decent text diff/merge engine for .NET ?

I got two text files that I would like to merge in some way. The first is just a edited version of the second.

Are there any open source tools available which can help me with that?

Edit: I want to find the changes between the two files and merge them as subversion does when it updates code files.

Community
  • 1
  • 1
jgauffin
  • 99,844
  • 45
  • 235
  • 372
  • Closing my own question as a duplicate :) Will not delete it since I didn't come up with the correct keywords. Might help others if I keep it as a duplicate. – jgauffin Jan 12 '11 at 14:07
  • are you searching for an SVN?(sub version tool ) then try http://tortoisesvn.net/downloads.html – Badr Jan 12 '11 at 14:07
  • No, I'm searching for a diff engine to be used in my app. – jgauffin Jan 12 '11 at 14:08
  • http://winmerge.org/ check out this may help its open source – Badr Jan 12 '11 at 14:20

1 Answers1

2

See example in this arkicle: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem.

Firstly you have two big files. Then you should find their longest common subsequence (LCS) and divide files to three parts:

1: Before LCS;
2: LCS;
3: After LCS.

Then you should compare independent parts "1" and parts "2" (you have a recursion). Iteratively you decrease secuence to compare.

Total complexity will be between O(n*log(n)) and O(n*n).

Manushin Igor
  • 3,398
  • 1
  • 26
  • 40