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 with another suffix (say *.mdl). The purpose of this is to allow me to employ a type of ‘clobber merge’ for a specific file type (ie: un-mergable files like configurations, auto-generated C, models, etc..)
In my .hgrc I’ve tried:
[merge-tools]
kdiff3=
clobbermerge=internal:other
clobbermerge.premerge = False
[merge-patterns]
**.c = kdiff3
**.h = kdiff3
**.mdl = clobbermerge
but it still triggers kdiff3 for all files. Thoughts?
An extension of this would be to perform a ‘clobber merge’ on a directory – but once the syntax is clear for a file suffix, the dir should be easy.
Merge tools can use any executable file. To set up a merge tool which always overwrites
$basewith$other, you can use the following:When using this strategy on Windows, there is one problem. You cannot simply replace
<copy executable>with thecopyshell 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 setclobbermerge.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:
The key to this configuration is the
argsfield:--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