Search code examples
mercurialcodecompare

Mercurial merge execute program script


How can I configure Mercurial to pop up a merguing program when 2 heads conflicts and a human merguing is required?

Im using Mercurial and HgSccPackage with Visual Studio. For merging and comparing im using Devart's CodeCompare.

The log shows:

[Pull started]

pulling from http://localhost:8000/
[Error: warning: conflicts during merge.]
searching for changes
[Error: merging JackPot/JackPotViewer/Application/FrameRender.cpp incomplete! (edit conflicts,       then use 'hg resolve --mark')]
all local heads known remotely
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
resolving manifests
calling hook preupdate.eol: <function preupdate at 0x023DA4F0>
couldn't find merge tool codecompare_merge
couldn't find merge tool codecompare_merge
couldn't find merge tool ecmerge
couldn't find merge tool filemerge
couldn't find merge tool gpyfm
couldn't find merge tool kdiff3
couldn't find merge tool meld
couldn't find merge tool bcompare
couldn't find merge tool UltraCompare
couldn't find merge tool araxis
couldn't find merge tool beyondcompare3
couldn't find merge tool diffuse
couldn't find merge tool diffmerge
couldn't find merge tool p4merge
couldn't find merge tool tkdiff
couldn't find merge tool tortoisemerge
couldn't find merge tool xxdiff
couldn't find merge tool gvimdiff
couldn't find merge tool vimdiff
couldn't find merge tool winmerge
couldn't find merge tool merge
couldn't find merge tool hgmerge
merging JackPot/JackPotViewer/Application/FrameRender.cpp
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges

[Operation completed. Exit code: 1]

My Mercurial.ini is:

[ui]
username=diego martinez <[email protected]>
ignore=C:\Users\diego\Documents\hgignore_global.txt
merge=codecompare_merge

[extensions]
eol=
extdiff=

[merge-tools]
codecompare_merge.regkey=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CodeCompare_is1
codecompare_merge.regname=InstallLocation
codecompare_merge.regappend=CodeMerge.exe
codecompare_merge.args=/SC=Hg /TF=$other /MF=$local /RF=$output /BF=$base /TT="Other: $other"     /MT="Local: $local" /RT="Output: $output" /BT="Base: $base"
codecompare_merge.binary=False
codecompare_merge.gui=True
codecompare_merge.checkconflicts=True
codecompare_merge.premerge=Keep


[extdiff]
cmd.codecompare=C:\Program Files\Devart\Code Compare\CodeCompare.exe
opts.codecompare=/SC=Hg /W /title1="$plabel1" /title2="$clabel" $parent $child

[merge-patterns]
*.*=codecompare_merge

[http_proxy]
host=
no=
user=
passwd=

Solution

  • In your settings, you are defining two tools, but have only successfully specified the path for one.

    You have defined codecompare as an external diff tool. I am assuming that it is working correctly when you try to look at a difference between two versions of a file e.g. hg codecompare -r "tip^:tip" file.txt

    The second tool is codecompare_merge which you have defined the install location using the set of keys:

    codecompare_merge.regkey=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CodeCompare_is1
    codecompare_merge.regname=InstallLocation
    codecompare_merge.regappend=CodeMerge.exe
    

    This tells hg to look in the registry at HKEY_CURRENT_USER (and then HKEY_LOCAL_MACHINE) for the regkey Install Location and then appends CodeMerge.exe to it to get the executable path. My guess is that there is an error somewhere there.

    You should be able to replace those three settings with the following to match the setting in the diff section:

    codecompare_merge.executeable=C:\Program Files\Devart\Code Compare\CodeCompare.exe
    

    Check out more details on the Selenic site.