annotate easyhg-merge.sh @ 292:a1c8630a0057

Return success if the external diff/merge _is_ found, not if it isn't!
author Chris Cannam
date Mon, 21 Feb 2011 18:16:15 +0000
parents 24820581e532
children ea62eb083ed4
rev   line source
Chris@215 1 #!/bin/bash
Chris@269 2 p=`dirname $0`
Chris@215 3 echo Args are: $@ 1>&2
Chris@215 4 if [ "$#" -lt 3 ]; then
Chris@215 5 echo Insufficient arguments: $@
Chris@215 6 exit 2
Chris@215 7 fi
Chris@215 8 while [ "$#" -gt 3 ]; do
Chris@215 9 shift
Chris@215 10 done
Chris@269 11 out="$1"
Chris@269 12 left="$1"
Chris@269 13 ancestor="$2"
Chris@269 14 right="$3"
Chris@269 15 found=""
Chris@269 16 for d in kdiff3 kdiff3.exe; do
Chris@269 17 if [ -x "$p/$d" ]; then
Chris@269 18 found=true
Chris@269 19 "$p/$d" "$ancestor" "$left" "$right" -o "$out"
Chris@269 20 break
Chris@274 21 elif [ -x "$(type -path $d)" ]; then
Chris@274 22 found=true
Chris@274 23 "$d" "$ancestor" "$left" "$right" -o "$out"
Chris@274 24 break;
Chris@269 25 fi
Chris@269 26 done
Chris@269 27 if [ -z "$found" ]; then
Chris@269 28 fm=/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge
Chris@269 29 if [ -x "$fm" ]; then
Chris@292 30 found=true
Chris@269 31 "$fm" -left "$left" -merge "$out" -ancestor "$ancestor" -right "$right"
Chris@269 32 fi
Chris@269 33 fi
Chris@292 34 [ -n "$found" ]