I am trying to set up WinMerge as the Merge tool into TortoiseHG;
Here is my Mercurial.ini:
; User specific Mercurial config file.
; See the hgrc man page for details.
[ui]
username = Bargio <>
merge = winmergeu
[extdiff]
cmd.winmerge = C:\Program Files (x86)\WinMerge\WinMergeU.exe
opts.winmerge = /e /x /ub /wl
[merge-tools]
winmergeu.executable = C:\Program Files (x86)\WinMerge\WinMergeU.exe
winmergeu.priority= 1
winmergeu.fixeol=True
winmergeu.checkchanged=True
winmergeu.args= /e /ub /dl other /dr local $other $local $output
winmergeu.gui=False
[tortoisehg]
vdiff = winmerge
Visual diff works perfectly but when I try to merge two files, I get the following error:
tool winmergeu can't handle binary
How can I fix it?
You no longer have to mess with the .ini file. As long as you have both TortoiseHG and WinMerge installed you will see it as an option in TortoiseHG Global Settings - TortoiseHG section - Three-way Merge Tool and Visual Diff Tool. It shows up as "winmergeu". Banged my head against the wall for a couple hours before I found this; I must be blind.
WinMerge 2.12.4.0 Unicode
TortoiseHg 2.5.1
Mercurial 2.3.2
You can add
winmergeu.binary=True
as found here if winmerge can merge binary files. If it can't you'll want to configure another merge tool that can and use matters to send the binary files to that tool.
Related
Mercurial can be configured using a mercurial.ini (or .hgrc) file. In the [ui] section (docs) there is a merge option.
This option is only documented as follows:
merge
The conflict resolution program to use during a manual merge.
In my current configuration I just have the line:
merge = kdiff3
But what is the allowed syntax for this setting? For instance, can I provide command line options to the specified program? Can I use an absolute path? etc.
Thanks
Note - the above cited docs do suggest looking in another link for more related information (https://www.selenic.com/mercurial/hg.1.html#merge-tools) but this does not specifically cover the configuration section I am interested in.
The approach isn't to add options to the [ui]\merge entry but instead to further configure the merge tool elsewhere.
The page on kdiff3 in the mercurial wiki is more elaborate on how you can configure kdiff3 with mercurial by using the [extdiff] and [merge-tools] sections. Excerpt:
[extensions]
hgext.extdiff =
[extdiff]
cmd.kdiff3 =
[merge-tools]
kdiff3.args = $base $local $other -o $output
That will add a new graphical diff command hg kdiff3 (using ExtdiffExtension), and tells Mercurial to use kdiff3 for merges.
We recently switched from P4Merge to BeyondCompare for working with our Hg repositories.
With P4Merge, when you merged branches, there was always a conflict in .hgtags, but just letting P4Merge do it's default action resulted in the correct merged .hgtags.
With BeyondCompare - it seems to just take one of the .hgtags, and not merge any of the differences. This results in loosing LOTS of tags.
How can we configure BeyondCompare to actually merge the changes for that file?
Using Beyond Compare 4.1.9 and Mercurial 3.7.3 on Ubuntu Linux 16.04, running hg merge after a pull and update for a conflicted .hgtags launched the .hgtags files in Beyond Compare's Text Merge and allowed me to merge them. It's possible there's an issue with your .hgrc configuration.
Here's the .hgrc that worked for diff and merge on my Ubuntu system:
[extensions]
# uncomment these lines to enable some popular extensions
# (see "hg help extensions" for more info)
#
# pager =
# progress =
# color =
hgext.extdiff =
[extdiff]
cmd.bcomp = bcompare
opts.bcomp = -ro
[merge-tools]
bcomp.executable = bcompare
bcomp.args = $local $other $base $output
bcomp.priority = 1
bcomp.premerge = True
bcomp.gui = True
[ui]
merge = bcomp
If you're using Windows or Mac, please let me know.
Is there any way to use WebStorm diff tool with TortoiseHg?
I've tried to set vdiff = /usr/local/bin/wstorm in .hgrc, but it didn't help.
You must perform more jobs, if you want to use external diff with Extdiff extension
Now custom diff tool can be added to Mercurial without this extension: read [merge-tools] section in MergeTools.rc for any merge-tool, but note only *diff keys, namely diffargs, diff3args, dirdiff
Enable invocation of WebStorm operations from the command line as instructed here (so that you can execute webstorm from the Terminal).
Put the followings to your .hgrc file:
[extensions]
extdiff =
[extdiff]
cmd.wsdiff = webstorm
opts.wsdiff = diff
(bonus) Make WebStorm as your default merge tool:
[ui]
merge = webstorm
[merge-tools]
webstorm.check = prompt
webstorm.args = merge $local $other $base $output
To ensure we use the trunk version of some files when merging we use internal:local:
[merge-patterns]
.hgtags = internal:local
pom.xml = internal:local
It seems in some cases, the merge does NOT use the local file, it does actually merge the changes from the remote repository. Why would this be happening?
The Mercurial "premerge" internal merge is actually successfully resolving merge conflicts for certain files before even launching a merge tool.
If the chosen merge tools premerge is
True then an internal merge is
attempted, and if it seems successful
then the result it will silently be
used without running the actual merge
tool
Check out this article on merge tool configuration for more info. Turning off premerge for a particular type of file (or directory) can be done using these modifications to your Mercurial.ini file:
[merge-tools]
<name>.premerge = False
<name>.args = --auto $base $other $other -o $output
<name>.executable = kdiff3
[merge-patterns]
**.xml = <name>
.hgtags = <name>
Note that kdiff3 should come with TortoiseHg by default, and <name> can be anything you want; call it, 'localFilesOnly' or something like that.
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 $base with $other, you can use the following:
[merge-tools]
clobbermerge.priority = 100
clobbermerge.premerge = False
clobbermerge.args = $other $output
clobbermerge.executable = <copy executable>
When using this strategy on Windows, there is one problem. You cannot simply replace <copy executable> 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
According to this Mercurial MergeToolConfiguration page, you should put the interal:other directly after the match pattern:
[merge-patterns]
**.mdl = internal:other