42 exit 1 |
42 exit 1 |
43 fi |
43 fi |
44 cp "$LOCAL.orig" "$LOCAL" |
44 cp "$LOCAL.orig" "$LOCAL" |
45 fi |
45 fi |
46 |
46 |
47 # on MacOS X try opendiff |
47 # on MacOS X try FileMerge.app, shipped with Apple's developer tools |
48 # (uses FileMerge.app, shipped with Apple's developer tools) |
48 # TODO: make proper temp files. foo.orig and foo.link are dangerous |
49 if type opendiff > /dev/null 2>&1; then |
49 FILEMERGE='/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge' |
50 opendiff "$LOCAL.orig" "$OTHER" -ancestor "$BASE" -merge "$LOCAL" || exit 1 |
50 if type "$FILEMERGE" > /dev/null 2>&1; then |
51 # prevent $OTHER from being removed too early |
51 cp "$LOCAL.orig" "$LOCAL" |
52 # can surely be done in a more elegant way |
52 ln "$LOCAL" "$LOCAL.link" |
53 sleep 1 |
53 # filemerge prefers the right by default |
54 exit 0 |
54 if ! "$FILEMERGE" -left "$OTHER" -right "$LOCAL" -ancestor "$BASE" -merge "$LOCAL" |
|
55 then |
|
56 echo "FileMerge failed to launch" |
|
57 exit 1 |
|
58 fi |
|
59 if ! test "$LOCAL" -ef "$LOCAL.link" |
|
60 then |
|
61 rm "$LOCAL.orig" "$LOCAL.link" |
|
62 exit 0 |
|
63 else |
|
64 rm "$LOCAL.link" |
|
65 echo "$LOCAL is unchanged. Was the merge successful?" |
|
66 select answer in yes no |
|
67 do |
|
68 if test "$answer" == "yes" |
|
69 then |
|
70 rm "$LOCAL.orig" |
|
71 exit 0 |
|
72 else |
|
73 exit 1 |
|
74 fi |
|
75 done |
|
76 exit 1 |
|
77 fi |
55 fi |
78 fi |
56 |
79 |
57 if [ -n "$DISPLAY" ]; then |
80 if [ -n "$DISPLAY" ]; then |
58 # try using kdiff3, which is fairly nice |
81 # try using kdiff3, which is fairly nice |
59 if type kdiff3 > /dev/null 2>&1; then |
82 if type kdiff3 > /dev/null 2>&1; then |