All:
I want to use kdiff to merge all files with a certain suffix (say *.c, *.h) and I want to do two things (turn off premerge and use internal:other) for all files
Merge tools can use any executable file. To set up a merge tool which always overwrites $base
with $other
, you can use the following:
[merge-tools]
clobbermerge.priority = 100
clobbermerge.premerge = False
clobbermerge.args = $other $output
clobbermerge.executable =
When using this strategy on Windows, there is one problem. You cannot simply replace
with the copy
shell command. For some reason, Mercurial fails to find shell commands in this context. I have not tried this on *nix.
To work around this problem, you can create a distribute a batch file that performs the copy. It simply needs to run: copy %1 %2
. Once placed on your PATH, you can set clobbermerge.executable=clobber.bat
.
If you have kdiff3 installed (comes with TortoiseHg on Windows), you can get the same results without the external batch file using a configuration like this:
[merge-tools]
clobbermerge.priority = 100
clobbermerge.premerge = False
clobbermerge.args = --auto $base $other $other -o $output
clobbermerge.executable = kdiff3
The key to this configuration is the args
field:
--auto
: tells kdiff3 not to open the GUI if there are no conflicts$base $other $other
: tells kdiff3 to only use $other
$output
: tells kdiff3 the name of the output file