Archive

Archive for August, 2009

Interactive file merging with Unison

August 13th, 2009 3 comments

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:

VimDiff (part of Vim)

Doesn’t work too well with Unison. I can’t get gnome-terminal (my terminal of choice) to execute synchronously so I was forced to fall back on XTerm instead.

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).

Meld

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.

KDiff3

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.

Conclusion

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.

Categories: HowTo's Tags: , ,