changeset 269:f6b71fda5957

* Rename the -osx.sh files to plain .sh, since we could use them elsewhere too. Rely on bundled kdiff3 if it exists.
author Chris Cannam
date Thu, 20 Jan 2011 13:37:00 +0000
parents b8ded5213d16
children facd86e268b9
files easyhg-extdiff-osx.sh easyhg-extdiff.sh easyhg-merge-osx.sh easyhg-merge.sh settingsdialog.cpp
diffstat 5 files changed, 56 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/easyhg-extdiff-osx.sh	Mon Jan 17 11:44:17 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/bash
-if [ $# -lt 2 ]; then 
-    echo Insufficient arguments: $@
-    exit 2
-fi
-while [ $# -gt 2 ]; do
-    shift
-done
-/usr/bin/opendiff "$1" "$2" | cat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/easyhg-extdiff.sh	Thu Jan 20 13:37:00 2011 +0000
@@ -0,0 +1,23 @@
+#!/bin/bash
+p=`dirname $0`
+if [ $# -lt 2 ]; then 
+    echo Insufficient arguments: $@
+    exit 2
+fi
+while [ $# -gt 2 ]; do
+    shift
+done
+found=""
+for d in kdiff3 kdiff3.exe; do
+    if [ -x "$p/$d" ]; then
+	found=true
+	"$p/$d" "$1" "$2"
+	break
+    fi
+done
+if [ -z "$found" ]; then
+    od=/usr/bin/opendiff
+    if [ -x "$od" ]; then
+	"$od" "$1" "$2" | cat
+    fi
+fi
--- a/easyhg-merge-osx.sh	Mon Jan 17 11:44:17 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#!/bin/bash
-echo Args are: $@ 1>&2
-if [ "$#" -lt 3 ]; then
-	echo Insufficient arguments: $@
-	exit 2
-fi
-while [ "$#" -gt 3 ]; do
-	shift
-done
-/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge \
-	-left "$1" -merge "$1" -ancestor "$2" -right "$3"
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/easyhg-merge.sh	Thu Jan 20 13:37:00 2011 +0000
@@ -0,0 +1,28 @@
+#!/bin/bash
+p=`dirname $0`
+echo Args are: $@ 1>&2
+if [ "$#" -lt 3 ]; then
+	echo Insufficient arguments: $@
+	exit 2
+fi
+while [ "$#" -gt 3 ]; do
+	shift
+done
+out="$1"
+left="$1"
+ancestor="$2"
+right="$3"
+found=""
+for d in kdiff3 kdiff3.exe; do
+    if [ -x "$p/$d" ]; then
+	found=true
+	"$p/$d" "$ancestor" "$left" "$right" -o "$out"
+	break
+    fi
+done
+if [ -z "$found" ]; then
+    fm=/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge
+    if [ -x "$fm" ]; then
+	"$fm" -left "$left" -merge "$out" -ancestor "$ancestor" -right "$right"
+    fi
+fi
--- a/settingsdialog.cpp	Mon Jan 17 11:44:17 2011 +0000
+++ b/settingsdialog.cpp	Thu Jan 20 13:37:00 2011 +0000
@@ -261,9 +261,7 @@
     QString diff = settings.value("extdiffbinary", "").toString();
     if (diff == "") {
         QStringList bases;
-#ifdef Q_OS_MAC
-        bases << "easyhg-extdiff-osx.sh";
-#endif 
+        bases << "easyhg-extdiff.sh";
         bases << "kompare" << "kdiff3" << "meld";
         bool found = false;
         foreach (QString base, bases) {
@@ -289,13 +287,10 @@
     }
     QString merge;
     QStringList bases;
-#ifdef Q_OS_MAC
-    bases << "easyhg-merge-osx.sh";
-#endif
-    // I think this is too dangerous, given command line ordering
-    // differences and suchlike.  Need to make sure the hg
-    // installation is configured OK instead
-//    bases << "meld" << "diffuse" << "kdiff3";
+    bases << "easyhg-merge.sh";
+    // NB it's not a good idea to add other tools here, as command
+    // line argument ordering varies.  Configure them through hgrc
+    // instead
     bool found = false;
     foreach (QString base, bases) {
         merge = findInPath(base, m_installPath, true);