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
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.
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.
Anyone know how integrate ExamDiff with Mercurial? I have KDiff3 set up but couldn't figure out how to set up ExamDiff.
Update: Per accepted answer, this .hgrc config worked:
[extensions]
hgext.extdiff =
[extdiff]
cmd.examdiff = C:\Program Files\ExamDiff Pro\ExamDiff.exe
Can run ExamDiff with the comand hg examdiff
This can be done with the Extdiff extension.