* [PATCH] mergetool--lib: add support for beyond compare
@ 2011-02-18 8:09 Chris Packham
2011-02-18 9:36 ` Charles Bailey
0 siblings, 1 reply; 2+ messages in thread
From: Chris Packham @ 2011-02-18 8:09 UTC (permalink / raw)
To: git; +Cc: Chris Packham
Add support for Beyond Compare as a diff/merge tool.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
Beyond compare is a non-free file comparison tool for Linux and Windows. A
trial version is available here [1]. People at $dayjob had used beyond compare
v2.0 for Windows a while ago but we hadn't paid attention since the change to
Linux. We noticed the other day that with v3.0 a native Linux version was now
available.
I wasn't sure about whether git should have support for non-free external
tools. Then I saw that support for Araxis had been added in b6f0621a, which
I've used as a guide for this patch.
The actual problem I was trying to solve was that if I configure an external
merge tool beyond compare gets confused when $BASE does not exist (I think this
might be a problem for other tools too). I could work around the problem with
the following messy config
[mergetool "bcompare"]
cmd = test -e \"$BASE\" && bcompare \"$BASE\" \"$LOCAL\" \"$REMOTE\" -mergeoutput=\"$MERGED\" || bcompare \"$LOCAL\" \"$REMOTE\" -mergeoutput=\"$MERGED\"
I've tested this with the Linux version and it works well, it'd be nice to hear
from some windows folks. In particular I think the option flags might change to
use '/' instead of '-'
[1] http://www.scootersoftware.com/download.php
Documentation/git-difftool.txt | 2 +-
Documentation/git-mergetool.txt | 2 +-
Documentation/merge-config.txt | 6 +++---
contrib/completion/git-completion.bash | 2 +-
git-mergetool--lib.sh | 18 ++++++++++++++++--
5 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt
index db87f1d..35ec927 100644
--- a/Documentation/git-difftool.txt
+++ b/Documentation/git-difftool.txt
@@ -32,7 +32,7 @@ OPTIONS
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.
+ ecmerge, diffuse, opendiff, p4merge, araxis and bcompare.
+
If a diff tool is not specified, 'git difftool'
will use the configuration variable `diff.tool`. If the
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index 1f75a84..0239929 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -27,7 +27,7 @@ OPTIONS
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.
+ diffuse, tortoisemerge, opendiff, p4merge, araxis and bcompare.
+
If a merge resolution program is not specified, 'git mergetool'
will use the configuration variable `merge.tool`. If the
diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt
index 1e5c22c..87c76e5 100644
--- a/Documentation/merge-config.txt
+++ b/Documentation/merge-config.txt
@@ -35,9 +35,9 @@ 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
- and there must be a corresponding mergetool.<tool>.cmd option.
+ "diffuse", "ecmerge", "tortoisemerge", "p4merge", "araxis",
+ "opendiff" and "bcompare". Any other value is treated is custom merge
+ tool and there must be a corresponding mergetool.<tool>.cmd option.
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 893b771..59ae12e 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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 bcompare
"
_git_difftool ()
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 77d4aee..c77ac7f 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -48,7 +48,7 @@ valid_tool () {
case "$1" in
kdiff3 | tkdiff | xxdiff | meld | opendiff | \
vimdiff | gvimdiff | vimdiff2 | gvimdiff2 | \
- emerge | ecmerge | diffuse | araxis | p4merge)
+ emerge | ecmerge | diffuse | araxis | p4merge | bcompare)
;; # happy
tortoisemerge)
if ! merge_mode; then
@@ -304,6 +304,20 @@ run_merge_tool () {
>/dev/null 2>&1
fi
;;
+ bcompare)
+ if merge_mode; then
+ if $base_present; then
+ "$merge_tool_path" \
+ "$BASE" "$LOCAL" "$REMOTE" -mergeoutput="$MERGED"
+ else
+ "$merge_tool_path" \
+ "$LOCAL" "$REMOTE" -mergeoutput="$MERGED"
+ fi
+ check_unchanged
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE"
+ fi
+ ;;
*)
merge_tool_cmd="$(get_merge_tool_cmd "$1")"
if test -z "$merge_tool_cmd"; then
@@ -343,7 +357,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 bcompare"
fi
case "${VISUAL:-$EDITOR}" in
*vim*)
--
1.7.4.1.48.g5673d.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mergetool--lib: add support for beyond compare
2011-02-18 8:09 [PATCH] mergetool--lib: add support for beyond compare Chris Packham
@ 2011-02-18 9:36 ` Charles Bailey
0 siblings, 0 replies; 2+ messages in thread
From: Charles Bailey @ 2011-02-18 9:36 UTC (permalink / raw)
To: Chris Packham; +Cc: git
On Fri, Feb 18, 2011 at 09:09:13PM +1300, Chris Packham wrote:
> Add support for Beyond Compare as a diff/merge tool.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>
> I wasn't sure about whether git should have support for non-free external
> tools. Then I saw that support for Araxis had been added in b6f0621a, which
> I've used as a guide for this patch.
You right, there is no specific reason not to support non-free merge
tools in mergetool; the major issue is testing. The patch looks
reasonable but I would prefer to see independent confirmation -
especially on windows, Beyond Compares' most popular supported platform
- before this patch is merged.
Charles.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-18 9:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18 8:09 [PATCH] mergetool--lib: add support for beyond compare Chris Packham
2011-02-18 9:36 ` Charles Bailey
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.