git-mergetool: add new merge tool TortoiseMerge
TortoiseMerge comes with TortoiseSVN or TortoiseGit for Windows. It can only be used as a merge tool with an existing base file. It cannot be used without a base nor as a diff tool. The documentation only mentions the slash '/' as command line option prefix, which refused to work, but the parser also accepts the dash '-' See http://code.google.com/p/msysgit/issues/detail?id=226 Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Markus Heidelberg committed
Apr 6, 2009 at 01:31 UTC
b98c212a9fd97300a8cf39015b8d693f319fd71c
3 files changed
+16
-5
Documentation/git-mergetool.txt
+2
-1
@@ -26,7 +26,8 @@ OPTIONS
26
--tool=<tool>::
27
Use the merge resolution program specified by <tool>.
28
Valid merge tools are:
29
- kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff
29
+ kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge,
30
+ tortoisemerge and opendiff
31
+
32
If a merge resolution program is not specified, 'git-mergetool'
33
will use the configuration variable `merge.tool`. If the
Documentation/merge-config.txt
+1
-1
@@ -23,7 +23,7 @@ merge.tool::
23
Controls which merge resolution program is used by
24
linkgit:git-mergetool[1]. Valid built-in values are: "kdiff3",
25
"tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff",
26
- "ecmerge" and
26
+ "ecmerge", tortoisemerge and
27
"opendiff". Any other value is treated is custom merge tool
28
and there must be a corresponding mergetool.<tool>.cmd option.
29
git-mergetool.sh
+13
-3
@@ -265,6 +265,16 @@ merge_file () {
265
fi
266
status=$?
267
;;
268
+ tortoisemerge)
269
+ if base_present ; then
270
+ touch "$BACKUP"
271
+ "$merge_tool_path" -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"
272
+ check_unchanged
273
+ else
274
+ echo "TortoiseMerge cannot be used without a base" 1>&2
275
+ status=1
276
+ fi
277
+ ;;
278
*)
279
if test -n "$merge_tool_cmd"; then
280
if test "$merge_tool_trust_exit_code" = "false"; then
@@ -345,7 +355,7 @@ valid_custom_tool()
355
356
valid_tool() {
357
case "$1" in
348
- kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge)
358
+ kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge | tortoisemerge)
359
;; # happy
360
*)
361
if ! valid_custom_tool "$1"; then
@@ -404,9 +414,9 @@ fi
414
if test -z "$merge_tool" ; then
415
if test -n "$DISPLAY"; then
416
if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
407
- merge_tool_candidates="meld kdiff3 tkdiff xxdiff gvimdiff"
417
+ merge_tool_candidates="meld kdiff3 tkdiff xxdiff tortoisemerge gvimdiff"
418
else
409
- merge_tool_candidates="kdiff3 tkdiff xxdiff meld gvimdiff"
419
+ merge_tool_candidates="kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff"
420
fi
421
fi
422
if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then