I am trying to use Beyond Compare for Visual Diff in TortoiseHg. eg Right click on a modified file in explorer and select Visual Diff from TortoiseHg context menu...
BeyondCompare opens but only shows the 'welcome' screen and not the file I want to diff. Am I missing something?
I have setup the mercurial.ini file as follows:
[extensions]
extdiff =
[extdiff]
cmd.bcomp = C:\Program Files (x86)\Beyond Compare 3\BCompare.exe
opts.bcomp = /ro
[tortoisehg]
vdiff = bcomp
[merge-tools]
bcomp.executable = C:\Program Files (x86)\Beyond Compare 3\BComp
bcomp.args = $local $other $base $output
bcomp.priority = 1
bcomp.premerge = True
bcomp.gui = True
[ui]
merge = bcomp
Found the answer.
Visual Diff Tool in TortoiseHg Global Settings had to be set to 'beyondcompare3' instead of 'bcomp'.
In our case the same problem happened when we added mercurial.ini to TortoiseHG. It looks like by default configuration comes from TortoiseHG\hgrc.d folder. Specifically diff and merge tools configuration can be found in MergeTools.rc.
Just for the reference, here is how Beyond Compare 3 can be configured manually in mercurial.ini:
[merge-tools]
bcomp.executable = C:\Program Files (x86)\Beyond Compare 3\BComp.exe
bcomp.priority = 1
bcomp.premerge = True
bcomp.gui = True
bcomp.args=$local $other $base /mergeoutput=$output /ro /lefttitle=parent1 /centertitle=base /righttitle=parent2 /outputtitle=merged /automerge /reviewconflicts /solo
bcomp.diffargs=/lro /lefttitle='$plabel1' /righttitle='$clabel' /solo /expandall $parent $child
bcomp.diff3args=$parent1 $parent2 $child /lefttitle='$plabel1' /centertitle='$clabel' /righttitle='$plabel2' /solo /ro
bcomp.dirdiff=True
Notice that there's no need in enabling extdiff extension. Also TortoiseHG should be restarted to apply this setting.
Related
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
I can't figure out why my extdiff extension is not working for Mercurial (on a Mac).
this is what my .hgrc file looks like:
[extensions]
fetch=
hgext.extdiff =
[extdiff]
cmd.kdiff3 =
[ui]
merge=kdiff3
[merge-tools]
kdiff3.executable=/Applications/kdiff3.app/Contents/MacOS/kdiff3
kdiff3.args = $base $local $other -o $output
and yet kdiff3 is recognized as a merge tool.. and can be run from the cmd line like "kdiff3". but what i'd like to do is use kdiff3 as a gui tool for comparing diff files.
like this:
hg extdiff -p kdiff3
this seems like the best way of using kdiff3 as a popup gui when using Mercurial.
I am new to this and am not sure if I am doing it right.
Thanks...!
By the way, when I try to run 'hg extdiff'
I get:
hg: unknown command 'extdiff'
'extdiff' is provided by the following extension:
extdiff command to allow external programs to compare revisions
use "hg help extensions" for information on enabling extensions
(even though it is in .hgrc)
Please note that merge-tool and external diff are different tools for different tasks.
For example you can use fmdiff script to use FileMerge for diff and k3diff for merge-tool:
Your .hgrc should be:
[extensions]
# enable external diff program
extdiff =
[extdiff]
cmd.opendiff = fmdiff
opts.opendiff =
[merge-tools]
# Override stock tool location
kdiff3.executable = /Applications/kdiff3.app/Contents/MacOS/kdiff3
# Specify command line
kdiff3.args = $base $local $other -o $output
# Give higher priority
kdiff3.priority = 1
Now you can use
hg opendiff myfile.ext
Please note that 'opendiff' is a custom wrapper name, so you can change it to your likes but it cannot be one of already reserver names.
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
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.