I was in need to compare 2 text files the other day with over 2k lines in each. I knew those should differ in just a couple of lines, but I had to be 100% sure that nothing is changed apart from those. The challenge though is that code blocks in those files where in different order. The situation called for Visual Diff tool capable of addressing moved text blocks.

Easier said than done - after few hours of googling and evaluation I haven’t progressed much. Still I’ve decided to share the results for someone who might face similar problem.

Disclaimer

This is NOT a comprehensive review of Visual Merge tools, but rather comparision of a single feature 'code block movement detection'.

I was working on my Windows desktop, therefore I have evaluated solutions available on this platform. Rating below is on a scale from 0 (feature is unavailable) to 10 (perfect):

Tool License Ability to detect block moves Rating
Notepad++ w/Compare plug-in GPL Highlights consecutive lines it believes moved 2
P4Merge / aka Helix Free/Other Not there 0
Araxis Merge Commercial Not there 0
Beyond Compare Commercial Can both detect and align moved blocks, but un-reliable 5
WinMerge GPL Subjectively, a bit better compared to Notepad++ 3
Code Compare Commercial Not there 1
SmartSynchronize Free/Commercial Not there 0
DeltaWalker Commercial Not there 0
ExamDiff Pro Commercial Not there 0
Meld GPL Not there 0
KDiff3 GPL Not there 0

Surprisingly, some of solutions claiming support for moved block detection fail to detect same block moved 100 lines below.

Beyond Compare

This one deserves a special note on this quick review. What make it stand out from the croud is a fact, that guys at Scooter Software took this use-case pretty seriously and implemented several options and algorythms to detect moved code blocks. What makes it shine, is that tool have a possibility of aligning blocks in a way that same code blocks are in the same place when doing visual comparision. Unfortunately, I was unable to get this feature to work reliably for my case (some blocks detected, some not or some block detected one time, but not the other).