Mercurial > hg-stable
diff tests/test-extdiff.t @ 23150:aff73c777b0b
extdiff: allow a preconfigured merge-tool to be invoked
There are three ways to configure an extdiff tool:
1) cmd.tool = (/path/to/exe optional)
2) tool = (path/to/exe optional)
3) tool = sometool someargs
Previously, if no executable is specified in the first two forms, the named tool
must be in $PATH, or the invocation fails. Since the [merge-tools] section
already has the path to the diff executable, and/or the registry keys to find
the executable on Windows, reuse that configuration for forms 1 and 2 instead of
failing. We already fallback to [diff-tools] and then [merge-tools] for program
arguments if they aren't specified in the [extdiff] section.
Since this additional lookup only occurs if an executable is not on the $PATH
for the named tool, this is backwards compatible. For now, we assume the user
knows what he is doing if a path is provided.
This change allows a configuration file like this (assuming beyondcompare3 is
configured in merge-tools), instead of hardcoding system specific a path:
[extdiff]
beyondcompare3 =
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 31 Oct 2014 21:34:55 -0400 |
parents | c1d93edcf004 |
children | b8f6d840d3ec |
line wrap: on
line diff
--- a/tests/test-extdiff.t Mon Nov 03 16:30:21 2014 -0600 +++ b/tests/test-extdiff.t Fri Oct 31 21:34:55 2014 -0400 @@ -178,6 +178,26 @@ */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) [1] +Fallback to merge-tools.tool.executable|regkey + $ mkdir dir + $ cat > 'dir/tool.sh' << EOF + > #!/bin/sh + > echo "** custom diff **" + > EOF + $ chmod +x dir/tool.sh + $ tool=`pwd`/dir/tool.sh + $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool + making snapshot of 2 files from rev * (glob) + a + b + making snapshot of 2 files from working directory + a + b + running "'$TESTTMP/a/dir/tool.sh' 'a.*' 'a'" in */extdiff.* (glob) + ** custom diff ** + cleaning up temp directory + [1] + $ cd .. #endif