Jason S
Jason S

Reputation: 189826

best merge tool for reordering code?

I have one C++ file that I had to reorder code, and I would like to use a compare tool to verify that I've reordered code and not messed anything up. For example:

old:

A1
A2
A3
B1
B2
B3
C1
C2
C3
C4
D1
D2

new:

D1
D2
A1
A2
A3
C1
C2
C3
C4
B1
B2
B3

Ideally the compare tool would automatically identify that I've reordered blocks A,B,C,D but that each block is intact. If it can't do that automatically, that's fine, but I'd like the ability to help it out, so once I identify a block reordering, it verifies that it's just a reordering and not a change.

We use Beyond Compare but it doesn't seem to have this feature.

Is there a tool out there (hopefully free ;) that does so?

Upvotes: 2

Views: 1250

Answers (2)

Ira Baxter
Ira Baxter

Reputation: 95402

Fundamentally you want to know if you have moved langauge structures around. So an ordered "line diff" (e.g., what unix diff gives you, and what many merge tools seem to implement) is not what you want.

Our SmartDifferencer is not a merge tool, but a not-line-oriented diff tool that can probably answer your question.

SmartDifferencer compares the syntax trees (expression, statement, block, method, ...) for your source code, and tells you the differences in terms of actions on your code (insert, delete, move, copy, copy-with-rename, rename-within-block).

SmartDifferncer is available for many langauges (including C++) as well as a variety of dialects for those many languages.

Upvotes: 1

mikerobi
mikerobi

Reputation: 20878

I think there are some tools that can help you. The one I am familiar with is the linux only meld. The screen shots should give you a good idea of what to look for.

Based on looking at some screen shots it looks like Araxis Merge and ECMerge have similar functionality.

Upvotes: 1

Related Questions