git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Prohaska <prohaska@zib.de>
To: git@vger.kernel.org
Cc: Steffen Prohaska <prohaska@zib.de>
Subject: [PATCH] mergetool: make Apple's FileMerge available as a merge_tool
Date: Sun, 17 Jun 2007 17:59:01 +0200	[thread overview]
Message-ID: <11820959413590-git-send-email-prohaska@zib.de> (raw)

Apple's developer tools include the application FileMerge,
which supports graphical three way merges with ancestor.
This patch makes the tool available through git-mergetool.

FileMerge is assumed to be installed at its default location.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 Documentation/git-mergetool.txt |    3 ++-
 git-mergetool.sh                |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index 6c32c6d..ff4cdf2 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -25,7 +25,8 @@ OPTIONS
 -t or --tool=<tool>::
 	Use the merge resolution program specified by <tool>.
 	Valid merge tools are:
-	kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, and opendiff
+	kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, opendiff,
+	and FileMerge
 +
 If a merge resolution program is not specified, 'git mergetool'
 will use the configuration variable merge.tool.  If the
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 7b66309..abe2a97 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -258,6 +258,16 @@ merge_file () {
 	    status=$?
 	    save_backup
 	    ;;
+	*FileMerge)
+	    touch "$BACKUP"
+	    if base_present; then
+		$merge_tool -left "$LOCAL" -right "$REMOTE" -ancestor "$BASE" -merge "$path" | cat
+	    else
+		$merge_tool -left "$LOCAL" -right "$REMOTE" -merge "$path" | cat
+	    fi
+	    check_unchanged
+	    save_backup
+	    ;;
     esac
     if test "$status" -ne 0; then
 	echo "merge of $path failed" 1>&2
@@ -326,6 +336,9 @@ if test -z "$merge_tool" ; then
         merge_tool_candidates="$merge_tool_candidates vimdiff"
     fi
     merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
+    if test $(uname) = "Darwin" ; then
+    	merge_tool_candidates="/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge $merge_tool_candidates"
+    fi
     echo "merge tool candidates: $merge_tool_candidates"
     for i in $merge_tool_candidates; do
         if test $i = emerge ; then
@@ -357,6 +370,13 @@ case "$merge_tool" in
 	    exit 1
 	fi
 	;;
+    *FileMerge)
+	merge_tool=/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge
+	if ! test -x $merge_tool ; then
+	    echo "FileMerge is not available"
+	    exit 1
+	fi
+	;;
     *)
 	echo "Unknown merge tool: $merge_tool"
 	exit 1
-- 
1.5.2.2.252.gbc777-dirty

             reply	other threads:[~2007-06-17 15:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-17 15:59 Steffen Prohaska [this message]
2007-06-17 16:13 ` [PATCH] mergetool: make Apple's FileMerge available as a merge_tool Steffen Prohaska
2007-06-17 18:12   ` Theodore Tso
2007-06-17 19:20     ` Steffen Prohaska
2007-06-18  9:39       ` Scott Lamb
2007-06-18 13:18         ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11820959413590-git-send-email-prohaska@zib.de \
    --to=prohaska@zib.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).