What are "synchronization points"?
Here is how to use synchronization points in Meld:
- Find two lines that should be matched but are considered by Meld as totally different lines
- Right-click on the left one, click "Add Synchronization Point"
- Right-click on the right one, click "Add Synchronization Point"
- That's it! Now Meld shows the two lines at the same level.
- You can add more synchronization couples, or clear all synchronization couples.
Example
In the screenshot below, you can see that the "GetSyncItemFromRemotePath" part is very similar between left and right, yet Meld fails to see this. So I insert a synchronization point on the left like this:
... and then I add another synchronization point on the "GetSyncItemFromRemotePath" on the right.
Here is the result:
It makes it much easier to spot the real differences, in this case the MIME type.
The intention is that the user be able to set up points in each of the files being compared, which are supposed to match up. This helps the code-matching algorithm figure out how the two files relate to each other, in cases where the differences are complex.
I'm still figuring it out by trial-and-error, setting a point in one file and then a matching point in the other. It's not working as well as I'd have hoped; I've had the sync points get into a mismatch state. But it does make things noticeably better.
As mentioned by others, synchronization points are a way to fix the diff algorithm and tell it what matches what when it gets confused on its own.
The key to using them is to LEFT CLICK on a line before right clicking and selecting Add Synchronization Point from the popup menu or main menu. The complete solution is then:
- Find two lines that should be synchronized but aren't.
- Left click on the line in the left pane.
- Right click at the same place and select Add Synchronization Point.
- Left click on the line in the right pane.
- Right click at the same place and select Add Synchronization Point.
Done that way, I can adjust the diff in locations where it otherwise breaks making it a lot faster to verify my changes. When it breaks just a few lines, it's fine, when it breaks several screens of lines, it becomes tedious to compare without such a feature.
The following shows a meld diff which gets confused at the else
keyword. That block on the left gets compared against the new default:
block. (click on pictures to enlarge)
First I left clicked on the else in the left panel and then right click + "Add Synchronization Point".
Next I left clicked on the else
in the right panel and again right click + "Add Synchronization Point".
The result is now correct:
Now I can see that just the .
were changed with ->
as I changed a vector of objects to a vector of shared pointer to objects.
Notice that Meld adds a black line along the place of synchronization. That makes it easier to see where you add your synchronization points.