Interactive file merging with Unison
After trying in vein to find decent documentation on the Merge functionality of Unison I eventually gave in and invested an hour or two trying out different Linux based merge programs in order to find something Unison, the merge program and I were happy with.
So onto the diff-merging candidates:
After using XTerm I immediately hit upon a problem: there is no sensible way of outputting the results of a merge in VimDiff. Which is a pity because I do prefer VIM as an editor but this lack of functionality is annoying (yes I could have used a wrapper script but I’m trying to keep this simple).
Very pretty but lacks features such as ‘Use Left-hand-side-file for all changes’ and some of the other filtering options provided by KDiff3.
Also, like, VimDiff, does not provide any sensible output mechanism of the eventually merged file.
Not as good looking as Meld but provides pretty much everything I want in a merge program including the all important merged file output that Unison requires.
Can get a little annoying though with its insentient pop-up boxes. I wish there were a ‘Dont show this option again’ option to each. KDE is usually quite good with this so I’m not sure why KDiff3 managed to escape this unspoken standard.
So how to use KDiff3 with Unison? First install kdiff3:
apt-get install kidff3
Then open your Unison profiles .prf file and insert the following:
merge = Name * -> kdiff3 CURRENT1 CURRENT2 -L1 'Local File' -L2 'Remote File' -o NEW -m confirmmerge = true
If you are comfortable with KDiff3 you could remove the ‘confirmmerge’ line which forces Unison to double check you actually want to accept the changes.
The downside to the above interactive merging process is there is no sensible way to preview the merge in Unison (the ‘View Merge’ button in the confirmation dialogue). For now though its preferable to not having this functionality at all.