{"thread":{"id":"26544","subject":"[PATCH] mergetool--lib: add support for beyond compare","startedAt":"2011-02-18T08:09:13Z","lastAt":"2011-02-18T09:36:51Z","messageCount":2,"participants":["Chris Packham","Charles Bailey"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"161519","messageId":"1298016553-2308-1-git-send-email-judge.packham@gmail.com","threadId":"26544","inReplyTo":null,"subject":"[PATCH] mergetool--lib: add support for beyond compare","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2011-02-18T08:09:13Z","receivedAt":"2011-02-18T08:09:13Z","isPatch":true,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"Add support for Beyond Compare as a diff/merge tool.\n\nSigned-off-by: Chris Packham <judge.packham@gmail.com>\n---\nBeyond compare is a non-free file comparison tool for Linux and Windows. A\ntrial version is available here [1]. People at $dayjob had used beyond compare\nv2.0 for Windows a while ago but we hadn't paid attention since the change to\nLinux. We noticed the other day that with v3.0 a native Linux version was now\navailable.\n\nI wasn't sure about whether git should have support for non-free external\ntools.  Then I saw that support for Araxis had been added in b6f0621a, which\nI've used as a guide for this patch.\n\nThe actual problem I was trying to solve was that if I configure an external\nmerge tool beyond compare gets confused when $BASE does not exist (I think this\nmight be a problem for other tools too). I could work around the problem with\nthe following messy config\n\n[mergetool \"bcompare\"]\n        cmd = test -e \\\"$BASE\\\" && bcompare \\\"$BASE\\\" \\\"$LOCAL\\\" \\\"$REMOTE\\\" -mergeoutput=\\\"$MERGED\\\" || bcompare \\\"$LOCAL\\\" \\\"$REMOTE\\\" -mergeoutput=\\\"$MERGED\\\"\n\nI've tested this with the Linux version and it works well, it'd be nice to hear\nfrom some windows folks. In particular I think the option flags might change to\nuse '/' instead of '-' \n\n[1] http://www.scootersoftware.com/download.php\n\n Documentation/git-difftool.txt         |    2 +-\n Documentation/git-mergetool.txt        |    2 +-\n Documentation/merge-config.txt         |    6 +++---\n contrib/completion/git-completion.bash |    2 +-\n git-mergetool--lib.sh                  |   18 ++++++++++++++++--\n 5 files changed, 22 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt\nindex db87f1d..35ec927 100644\n--- a/Documentation/git-difftool.txt\n+++ b/Documentation/git-difftool.txt\n@@ -32,7 +32,7 @@ OPTIONS\n \tUse the diff tool specified by <tool>.\n \tValid merge tools are:\n \tkdiff3, kompare, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff,\n-\tecmerge, diffuse, opendiff, p4merge and araxis.\n+\tecmerge, diffuse, opendiff, p4merge, araxis and bcompare.\n +\n If a diff tool is not specified, 'git difftool'\n will use the configuration variable `diff.tool`.  If the\ndiff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt\nindex 1f75a84..0239929 100644\n--- a/Documentation/git-mergetool.txt\n+++ b/Documentation/git-mergetool.txt\n@@ -27,7 +27,7 @@ OPTIONS\n \tUse the merge resolution program specified by <tool>.\n \tValid merge tools are:\n \tkdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge,\n-\tdiffuse, tortoisemerge, opendiff, p4merge and araxis.\n+\tdiffuse, tortoisemerge, opendiff, p4merge, araxis and bcompare.\n +\n If a merge resolution program is not specified, 'git mergetool'\n will use the configuration variable `merge.tool`.  If the\ndiff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt\nindex 1e5c22c..87c76e5 100644\n--- a/Documentation/merge-config.txt\n+++ b/Documentation/merge-config.txt\n@@ -35,9 +35,9 @@ merge.tool::\n \tControls which merge resolution program is used by\n \tlinkgit:git-mergetool[1].  Valid built-in values are: \"kdiff3\",\n \t\"tkdiff\", \"meld\", \"xxdiff\", \"emerge\", \"vimdiff\", \"gvimdiff\",\n-\t\"diffuse\", \"ecmerge\", \"tortoisemerge\", \"p4merge\", \"araxis\" and\n-\t\"opendiff\".  Any other value is treated is custom merge tool\n-\tand there must be a corresponding mergetool.<tool>.cmd option.\n+\t\"diffuse\", \"ecmerge\", \"tortoisemerge\", \"p4merge\", \"araxis\",\n+\t\"opendiff\" and \"bcompare\".  Any other value is treated is custom merge\n+\ttool and there must be a corresponding mergetool.<tool>.cmd option.\n \n merge.verbosity::\n \tControls the amount of output shown by the recursive merge\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 893b771..59ae12e 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1358,7 +1358,7 @@ _git_diff ()\n }\n \n __git_mergetools_common=\"diffuse ecmerge emerge kdiff3 meld opendiff\n-\t\t\ttkdiff vimdiff gvimdiff xxdiff araxis p4merge\n+\t\t\ttkdiff vimdiff gvimdiff xxdiff araxis p4merge bcompare\n \"\n \n _git_difftool ()\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex 77d4aee..c77ac7f 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -48,7 +48,7 @@ valid_tool () {\n \tcase \"$1\" in\n \tkdiff3 | tkdiff | xxdiff | meld | opendiff | \\\n \tvimdiff | gvimdiff | vimdiff2 | gvimdiff2 | \\\n-\temerge | ecmerge | diffuse | araxis | p4merge)\n+\temerge | ecmerge | diffuse | araxis | p4merge | bcompare)\n \t\t;; # happy\n \ttortoisemerge)\n \t\tif ! merge_mode; then\n@@ -304,6 +304,20 @@ run_merge_tool () {\n \t\t\t\t>/dev/null 2>&1\n \t\tfi\n \t\t;;\n+\tbcompare)\n+\t\tif merge_mode; then\n+\t\t\tif $base_present; then\n+\t\t\t\t\"$merge_tool_path\" \\\n+\t\t\t\t\t\"$BASE\" \"$LOCAL\" \"$REMOTE\" -mergeoutput=\"$MERGED\"\n+\t\t\telse\n+\t\t\t\t\"$merge_tool_path\" \\\n+\t\t\t\t\t\"$LOCAL\" \"$REMOTE\" -mergeoutput=\"$MERGED\"\n+\t\t\tfi\n+\t\t\tcheck_unchanged\n+\t\telse\n+\t\t\t\"$merge_tool_path\" \"$LOCAL\" \"$REMOTE\"\n+\t\tfi\n+\t\t;;\n \t*)\n \t\tmerge_tool_cmd=\"$(get_merge_tool_cmd \"$1\")\"\n \t\tif test -z \"$merge_tool_cmd\"; then\n@@ -343,7 +357,7 @@ guess_merge_tool () {\n \t\telse\n \t\t\ttools=\"opendiff kdiff3 tkdiff xxdiff meld $tools\"\n \t\tfi\n-\t\ttools=\"$tools gvimdiff diffuse ecmerge p4merge araxis\"\n+\t\ttools=\"$tools gvimdiff diffuse ecmerge p4merge araxis bcompare\"\n \tfi\n \tcase \"${VISUAL:-$EDITOR}\" in\n \t*vim*)\n-- \n1.7.4.1.48.g5673d.dirty\n"},{"id":"161525","messageId":"20110218093651.GA8700@hashpling.org","threadId":"26544","inReplyTo":"1298016553-2308-1-git-send-email-judge.packham@gmail.com","subject":"Re: [PATCH] mergetool--lib: add support for beyond compare","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2011-02-18T09:36:51Z","receivedAt":"2011-02-18T09:36:51Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"On Fri, Feb 18, 2011 at 09:09:13PM +1300, Chris Packham wrote:\n> Add support for Beyond Compare as a diff/merge tool.\n> \n> Signed-off-by: Chris Packham <judge.packham@gmail.com>\n> ---\n> \n> I wasn't sure about whether git should have support for non-free external\n> tools.  Then I saw that support for Araxis had been added in b6f0621a, which\n> I've used as a guide for this patch.\n \nYou right, there is no specific reason not to support non-free merge\ntools in mergetool; the major issue is testing. The patch looks\nreasonable but I would prefer to see independent confirmation -\nespecially on windows, Beyond Compares' most popular supported platform\n- before this patch is merged.\n\nCharles.\n"}]}