Skip to contentSkip to conversation

Adding Beyond Compare as a merge tool

PATCH In review Sebastian Schuberth 4 participants 9 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

v2 cover Adding Beyond Compare as a merge tool

This is the second iteration of the series to add Beyond Compare as a merge tool as an alternative to

cp/mergetool-beyondcompare

It replaces calling "BCompare" with "bcompare". While the first is the correct binary name, the latter is the name of the wrapper script to start Beyond Compare on Linux. On Windows, this change does not matter, as Windows is case-insensitive.

Moreover, the third patch in the series has been dropped for similar reasons. While the binary for ECMerge is called "guimerge", the link in /usr/local/bin is called "ecmerge". There is no "ecmerge" executable on Windows, but Windows users need to set mergetool.ecmerge.path anyway, and just specify the path to "guimerge" here.

Sebastian Schuberth (2):
mergetool--lib: Sort tools alphabetically for easier lookup
mergetool--lib: Add Beyond Compare 3 as a tool

 Documentation/git-difftool.txt         |    4 +-
 Documentation/git-mergetool.txt        |    4 +-
 Documentation/merge-config.txt         |    8 +-
 contrib/completion/git-completion.bash |    2 +-
 git-gui/lib/mergetool.tcl              |  101 +++++++------
 git-mergetool--lib.sh                  |  247 +++++++++++++++++---------------
 6 files changed, 195 insertions(+), 171 deletions(-)
Signature · 1 line
1.7.3.2.msysgit.6.dirty
#1 lore raw

PATCH v2 1/2 mergetool--lib: Sort tools alphabetically for easier lookup

---
 Documentation/git-difftool.txt  |    4 +-
 Documentation/git-mergetool.txt |    4 +-
 Documentation/merge-config.txt  |    8 +-
 git-gui/lib/mergetool.tcl       |   94 ++++++++--------
 git-mergetool--lib.sh           |  245 +++++++++++++++++++--------------------
 5 files changed, 177 insertions(+), 178 deletions(-)
Documentation/git-difftool.txt +2 -2
index db87f1d..4c8825d 100644
@@ -31,8 +31,8 @@ OPTIONS
 --tool=<tool>::
 	Use the diff tool specified by <tool>.
 	Valid merge tools are:
-	kdiff3, kompare, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff,
-	ecmerge, diffuse, opendiff, p4merge and araxis.
+	araxis, diffuse, emerge, ecmerge, gvimdiff, kdiff3,
+	kompare, meld, opendiff, p4merge, tkdiff, vimdiff and xxdiff.
 +
 If a diff tool is not specified, 'git difftool'
 will use the configuration variable `diff.tool`.  If the
Documentation/git-mergetool.txt +2 -2
index 1f75a84..4987245 100644
@@ -26,8 +26,8 @@ OPTIONS
 --tool=<tool>::
 	Use the merge resolution program specified by <tool>.
 	Valid merge tools are:
-	kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge,
-	diffuse, tortoisemerge, opendiff, p4merge and araxis.
+	araxis, diffuse, ecmerge, emerge, gvimdiff, kdiff3,
+	meld, opendiff, p4merge, tkdiff, tortoisemerge, vimdiff and xxdiff.
 +
 If a merge resolution program is not specified, 'git mergetool'
 will use the configuration variable `merge.tool`.  If the
Documentation/merge-config.txt +4 -4
index 1e5c22c..90587db 100644
@@ -33,10 +33,10 @@ merge.stat::
 
 merge.tool::
 	Controls which merge resolution program is used by
-	linkgit:git-mergetool[1].  Valid built-in values are: "kdiff3",
-	"tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff",
-	"diffuse", "ecmerge", "tortoisemerge", "p4merge", "araxis" and
-	"opendiff".  Any other value is treated is custom merge tool
+	linkgit:git-mergetool[1].  Valid built-in values are: "araxis",
+	"diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
+	"opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
+	and "xxdiff".  Any other value is treated is custom merge tool
 	and there must be a corresponding mergetool.<tool>.cmd option.
 
 merge.verbosity::
git-gui/lib/mergetool.tcl +47 -47

137 lines not on this page · raw message

git-mergetool--lib.sh +122 -123

339 lines not on this page · raw message

Signature · 1 line
1.7.3.2.msysgit.6.dirty
#2 lore raw

PATCH v2 2/2 mergetool--lib: Add Beyond Compare 3 as a tool

In reply to Sebastian Schuberth
---
 Documentation/git-difftool.txt         |    2 +-
 Documentation/git-mergetool.txt        |    2 +-
 Documentation/merge-config.txt         |    2 +-
 contrib/completion/git-completion.bash |    2 +-
 git-gui/lib/mergetool.tcl              |    7 +++++++
 git-mergetool--lib.sh                  |   22 ++++++++++++++++++++--
 6 files changed, 31 insertions(+), 6 deletions(-)
Documentation/git-difftool.txt +1 -1
index 4c8825d..f087eff 100644
@@ -31,7 +31,7 @@ OPTIONS
 --tool=<tool>::
 	Use the diff tool specified by <tool>.
 	Valid merge tools are:
-	araxis, diffuse, emerge, ecmerge, gvimdiff, kdiff3,
+	araxis, bc3, diffuse, emerge, ecmerge, gvimdiff, kdiff3,
 	kompare, meld, opendiff, p4merge, tkdiff, vimdiff and xxdiff.
 +
 If a diff tool is not specified, 'git difftool'
Documentation/git-mergetool.txt +1 -1
index 4987245..740b3f1 100644
@@ -26,7 +26,7 @@ OPTIONS
 --tool=<tool>::
 	Use the merge resolution program specified by <tool>.
 	Valid merge tools are:
-	araxis, diffuse, ecmerge, emerge, gvimdiff, kdiff3,
+	araxis, bc3, diffuse, ecmerge, emerge, gvimdiff, kdiff3,
 	meld, opendiff, p4merge, tkdiff, tortoisemerge, vimdiff and xxdiff.
 +
 If a merge resolution program is not specified, 'git mergetool'
Documentation/merge-config.txt +1 -1
index 90587db..33bf74c 100644
@@ -34,7 +34,7 @@ merge.stat::
 merge.tool::
 	Controls which merge resolution program is used by
 	linkgit:git-mergetool[1].  Valid built-in values are: "araxis",
-	"diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
+	"bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
 	"opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
 	and "xxdiff".  Any other value is treated is custom merge tool
 	and there must be a corresponding mergetool.<tool>.cmd option.
contrib/completion/git-completion.bash +1 -1
index 893b771..058c2a9 100755
@@ -1358,7 +1358,7 @@ _git_diff ()
 }
 
 __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
-			tkdiff vimdiff gvimdiff xxdiff araxis p4merge
+			tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3
 "
 
 _git_difftool ()
git-gui/lib/mergetool.tcl +7 -0
index 249e0cf..3c8e73b 100644
@@ -187,6 +187,13 @@ proc merge_resolve_tool2 {} {
 				 "$LOCAL" "$REMOTE" "$MERGED"]
 		}
 	}
+	bc3 {
+		if {$base_stage ne {}} {
+			set cmdline [list "$merge_tool_path" "$LOCAL" "$REMOTE" "$BASE" -mergeoutput="$MERGED"]
+		} else {
+			set cmdline [list "$merge_tool_path" "$LOCAL" "$REMOTE" -mergeoutput="$MERGED"]
+		}
+	}
 	ecmerge {
 		if {$base_stage ne {}} {
 			set cmdline [list "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" --default --mode=merge3 --to="$MERGED"]
git-mergetool--lib.sh +20 -2
index 9fb82e5..bfb3913 100644
@@ -13,6 +13,9 @@ translate_merge_tool_path () {
 	araxis)
 		echo compare
 		;;
+	bc3)
+		echo bcompare
+		;;
 	emerge)
 		echo emacs
 		;;
@@ -46,7 +49,7 @@ check_unchanged () {
 
 valid_tool () {
 	case "$1" in
-	araxis | diffuse | ecmerge | emerge | gvimdiff | gvimdiff2 | \
+	araxis | bc3 | diffuse | ecmerge | emerge | gvimdiff | gvimdiff2 | \
 	kdiff3 | meld | opendiff | p4merge | tkdiff | vimdiff | vimdiff2 | xxdiff)
 		;; # happy
 	kompare)
@@ -106,6 +109,21 @@ run_merge_tool () {
 				>/dev/null 2>&1
 		fi
 		;;
+	bc3)
+		if merge_mode; then
+			touch "$BACKUP"
+			if $base_present; then
+				"$merge_tool_path" "$LOCAL" "$REMOTE" "$BASE" \
+					-mergeoutput="$MERGED"
+			else
+				"$merge_tool_path" "$LOCAL" "$REMOTE" \
+					-mergeoutput="$MERGED"
+			fi
+			check_unchanged
+		else
+			"$merge_tool_path" "$LOCAL" "$REMOTE"
+		fi
+		;;
 	diffuse)
 		if merge_mode; then
 			touch "$BACKUP"
@@ -342,7 +360,7 @@ guess_merge_tool () {
 		else
 			tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
 		fi
-		tools="$tools gvimdiff diffuse ecmerge p4merge araxis"
+		tools="$tools gvimdiff diffuse ecmerge p4merge araxis bc3"
 	fi
 	case "${VISUAL:-$EDITOR}" in
 	*vim*)
Signature · 1 line
1.7.3.2.msysgit.6.dirty
Tested-by on v2 2/2
#3 lore raw

Re: [PATCH 2/2 v2] mergetool--lib: Add Beyond Compare 3 as a tool

Quoted 9 lines · Sebastian Schuberth
---
 Documentation/git-difftool.txt         |    2 +-
 Documentation/git-mergetool.txt        |    2 +-
 Documentation/merge-config.txt         |    2 +-
 contrib/completion/git-completion.bash |    2 +-
 git-gui/lib/mergetool.tcl              |    7 +++++++
 git-mergetool--lib.sh                  |   22 ++++++++++++++++++++--
 6 files changed, 31 insertions(+), 6 deletions(-)

Works for me.

#4 lore raw

Re: [PATCH 2/2 v2] mergetool--lib: Add Beyond Compare 3 as a tool

Quoted 10 lines · Chris Packham
Quoted 9 lines

---

 Documentation/git-difftool.txt         |    2 +-
 Documentation/git-mergetool.txt        |    2 +-
 Documentation/merge-config.txt         |    2 +-
 contrib/completion/git-completion.bash |    2 +-
 git-gui/lib/mergetool.tcl              |    7 +++++++
 git-mergetool--lib.sh                  |   22 ++++++++++++++++++++--
 6 files changed, 31 insertions(+), 6 deletions(-)
Quoted 3 lines

Works for me.

Great, thanks for testing!

Signature · 1 line
Sebastian Schuberth
#5 lore raw
In reply to Sebastian Schuberth
Quoted 11 lines · Sebastian Schuberth

Sebastian Schuberth (2):
mergetool--lib: Sort tools alphabetically for easier lookup
mergetool--lib: Add Beyond Compare 3 as a tool

 Documentation/git-difftool.txt         |    4 +-
 Documentation/git-mergetool.txt        |    4 +-
 Documentation/merge-config.txt         |    8 +-
 contrib/completion/git-completion.bash |    2 +-
 git-gui/lib/mergetool.tcl              |  101 +++++++------
 git-mergetool--lib.sh                  |  247 +++++++++++++++++---------------
 6 files changed, 195 insertions(+), 171 deletions(-)

Hmm, I really would have liked if you took the hint and separated git-gui bits into separate patches.

I saw Tested-by from Chris, so I'll add that to what is queued on 'pu', ask Pat to keep an eye on the ss/git-gui-mergetool branch, and then merge my ss/mergetool--lib branch to 'master' during my next integration run.

IOW, no need for further actions from you on this topic for now unless you have incremental improvements on top.

Thanks.

#6 lore raw
Quoted 12 lines · Junio C Hamano
Quoted 11 lines

Sebastian Schuberth (2):
  mergetool--lib: Sort tools alphabetically for easier lookup
  mergetool--lib: Add Beyond Compare 3 as a tool

 Documentation/git-difftool.txt         |    4 +-
 Documentation/git-mergetool.txt        |    4 +-
 Documentation/merge-config.txt         |    8 +-
 contrib/completion/git-completion.bash |    2 +-
 git-gui/lib/mergetool.tcl              |  101 +++++++------
 git-mergetool--lib.sh                  |  247 +++++++++++++++++---------------
 6 files changed, 195 insertions(+), 171 deletions(-)
Quoted 2 lines

Hmm, I really would have liked if you took the hint and separated git-gui bits into separate patches.

Sorry, I somehow thought this would not be necessary as there were no changes to git-gui/lib/mergetool.tcl since v1, but that was a a dumb thought. I'll separate the patches if I have incremental updates.

Signature · 1 line
Sebastian Schuberth
#7 lore raw
In reply to Junio C Hamano
Quoted 14 lines · Junio C Hamano
Quoted 11 lines · Sebastian Schuberth

Sebastian Schuberth (2):
mergetool--lib: Sort tools alphabetically for easier lookup
mergetool--lib: Add Beyond Compare 3 as a tool

 Documentation/git-difftool.txt         |    4 +-
 Documentation/git-mergetool.txt        |    4 +-
 Documentation/merge-config.txt         |    8 +-
 contrib/completion/git-completion.bash |    2 +-
 git-gui/lib/mergetool.tcl              |  101 +++++++------
 git-mergetool--lib.sh                  |  247 +++++++++++++++++---------------
 6 files changed, 195 insertions(+), 171 deletions(-)
Quoted 6 lines

Hmm, I really would have liked if you took the hint and separated git-gui bits into separate patches.

I saw Tested-by from Chris, so I'll add that to what is queued on 'pu', ask Pat to keep an eye on the ss/git-gui-mergetool branch, and then merge my ss/mergetool--lib branch to 'master' during my next integration run.

Where is this branch?

Signature · 2 lines
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
#8 lore raw
Quoted 16 lines · Pat Thoyts
Quoted 14 lines · Junio C Hamano
Quoted 11 lines · Sebastian Schuberth

Sebastian Schuberth (2):
mergetool--lib: Sort tools alphabetically for easier lookup
mergetool--lib: Add Beyond Compare 3 as a tool

 Documentation/git-difftool.txt         |    4 +-
 Documentation/git-mergetool.txt        |    4 +-
 Documentation/merge-config.txt         |    8 +-
 contrib/completion/git-completion.bash |    2 +-
 git-gui/lib/mergetool.tcl              |  101 +++++++------
 git-mergetool--lib.sh                  |  247 +++++++++++++++++---------------
 6 files changed, 195 insertions(+), 171 deletions(-)
Quoted 8 lines
Quoted 6 lines

Hmm, I really would have liked if you took the hint and separated git-gui bits into separate patches.

I saw Tested-by from Chris, so I'll add that to what is queued on 'pu', ask Pat to keep an eye on the ss/git-gui-mergetool branch, and then merge my ss/mergetool--lib branch to 'master' during my next integration run.

Where is this branch?

$ git log --oneline --first-parent master..pu

Look for the commit that merge ss/git-gui-mergetool and pick its second parent, which is ffe6dc0 (mergetool--lib: Add Beyond Compare 3 as a tool, 2011-02-27).

Thanks.