comparison 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
comparison
equal deleted inserted replaced
23149:dc80a0ad7bf5 23150:aff73c777b0b
174 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) 174 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
175 [1] 175 [1]
176 176
177 $ hg extdif -p echo -r "0::1" 177 $ hg extdif -p echo -r "0::1"
178 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) 178 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
179 [1]
180
181 Fallback to merge-tools.tool.executable|regkey
182 $ mkdir dir
183 $ cat > 'dir/tool.sh' << EOF
184 > #!/bin/sh
185 > echo "** custom diff **"
186 > EOF
187 $ chmod +x dir/tool.sh
188 $ tool=`pwd`/dir/tool.sh
189 $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool
190 making snapshot of 2 files from rev * (glob)
191 a
192 b
193 making snapshot of 2 files from working directory
194 a
195 b
196 running "'$TESTTMP/a/dir/tool.sh' 'a.*' 'a'" in */extdiff.* (glob)
197 ** custom diff **
198 cleaning up temp directory
179 [1] 199 [1]
180 200
181 $ cd .. 201 $ cd ..
182 202
183 #endif 203 #endif