Skip to contentSkip to conversation

mergetool--lib: add new merge tool TortoiseMerge

PATCH In review David Aguilar 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mergetool--lib: add new merge tool TortoiseMerge

From: Markus Heidelberg <[email protected]>

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

---

This is Markus' patch rebased on top of my latest refactoring patch. It didn't apply cleanly so I figured I'd resolve the merge myself.

 git-mergetool--lib.sh |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
git-mergetool--lib.sh +14 -1
index dcd4516..268485a 100644
@@ -46,10 +46,13 @@ check_unchanged () {
 
 valid_tool () {
 	case "$1" in
-	kdiff3 | kompare | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge | diffuse)
+	kdiff3 | kompare | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge | diffuse | tortoisemerge)
 		if test "$1" = "kompare" && ! diff_mode; then
 			return 1
 		fi
+		if test "$1" = "tortoisemerge" && ! merge_mode; then
+			return 1
+		fi
 		;; # happy
 	*)
 		if test -z "$(get_merge_tool_cmd "$1")"; then
@@ -220,6 +223,16 @@ run_merge_tool () {
 		fi
 		status=$?
 		;;
+	tortoisemerge)
+		if $base_present; then
+			touch "$BACKUP"
+			"$merge_tool_path" -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"
+			check_unchanged
+		else
+			echo "TortoiseMerge cannot be used without a base" 1>&2
+			status=1
+		fi
+		;;
 	*)
 		if test -n "$merge_tool_cmd"; then
 			if merge_mode &&
Signature · 1 line
1.6.2.1.469.gdffc1
#1 lore raw
Quoted 19 lines · David Aguilar
git-mergetool--lib.sh +4 -1
index dcd4516..268485a 100644
@@ -46,10 +46,13 @@ check_unchanged () {
 
 valid_tool () {
 	case "$1" in
-	kdiff3 | kompare | tkdiff | xxdiff | meld | opendiff | emerge |  
 vimdiff | gvimdiff | ecmerge | diffuse)
+	kdiff3 | kompare | tkdiff | xxdiff | meld | opendiff | emerge |  
 vimdiff | gvimdiff | ecmerge | diffuse | tortoisemerge)
 		if test "$1" = "kompare" && ! diff_mode; then
 			return 1
 		fi
+		if test "$1" = "tortoisemerge" && ! merge_mode; then
+			return 1
+		fi
 		;; # happy
Quoted 2 lines
	*)
		if test -z "$(get_merge_tool_cmd "$1")"; then

Why is case "$1" being followed by two if test "$1" =s? Wouldn't it be simpler to have separate case arms for them? Especially with how long that list is getting...

~~ Brian

#2 lore raw
Quoted 20 lines · Brian Gernhardt
Quoted 9 lines · David Aguilar
valid_tool () {
	case "$1" in
	<lots-of-stuff>)
		if test "$1" = "kompare" && ! diff_mode; then
			return 1
		fi
git-mergetool--lib.sh +3 -0
+		if test "$1" = "tortoisemerge" && ! merge_mode; then
+			return 1
+		fi
Quoted 3 lines
		;; # happy
	*)
		if test -z "$(get_merge_tool_cmd "$1")"; then

Why is case "$1" being followed by two if test "$1" =s? Wouldn't it be simpler to have separate case arms for them? Especially with how long that list is getting...

Quoted 1 line

~~ Brian

It would. It wasn't until after the rewrite that I remembered this email... oh well [PATCH v2 14/14] it is

Signature · 1 line
	David