mercurialdiffmerge

How do I make diffmerge do a three-way merge with Mercurial?


I am currently using the commmand hg diffmerge -r 32 -r 30 myfile, but this only displays two windows, not three. How can I make it do a three way merge?

.hgrc

[ui]
merge=diffmerge

[extensions]
collapse=~/.hgext/collapse.py
hgext.purge=
hgext.extdiff=
hgext.graphlog=

[extdiff]
cmd.diffmerge=/usr/bin/diffmerge

[merge-tools]
diffmerge.executable=/usr/bin/diffmerge
diffmerge.args= --result=$output -t1="Local Version" -t2=$output -t3="Other Version" --caption=$output $local $base $other
diffmerge.binary=False
diffmerge.symlinks=False
diffmerge.gui=True
diffmerge.premerge=True 

Solution

  • I suppose you mean you're using SourceGear DiffMerge as external merge tool. What's your .hgrc? Is it based on the sample from hg website?

    My guess is that your diffmerge.args is problematic. You can try running diffmerge manually with those arguments to make sure it works.


    With your .hgrc it's clear now. Your command hg diffmerge -r 32 -r 30 myfile is NOT a merge command, instead you're asking hg to use diffmerge as the external diff tool (specified in [extdiff] section) to compare myfile between version 32 and 30. There's not a 3rd version involved.

    For merge you run hg merge [-r<the other head>], and since your .hgrc tells hg to use diffmerge as merge tool (specified in [ui] section) hg will use diffmerge for the 3-way merge. I verified that it works in my Windows setup with identical hgrc.