##// END OF EJS Templates
Safer version of FileMerge merge
Brendan Cully -
r1664:4338e33c default
parent child Browse files
Show More
@@ -44,14 +44,37 b' elif [ -n "$DIFF3" ]; then'
44 44 cp "$LOCAL.orig" "$LOCAL"
45 45 fi
46 46
47 # on MacOS X try opendiff
48 # (uses FileMerge.app, shipped with Apple's developer tools)
49 if type opendiff > /dev/null 2>&1; then
50 opendiff "$LOCAL.orig" "$OTHER" -ancestor "$BASE" -merge "$LOCAL" || exit 1
51 # prevent $OTHER from being removed too early
52 # can surely be done in a more elegant way
53 sleep 1
47 # on MacOS X try FileMerge.app, shipped with Apple's developer tools
48 # TODO: make proper temp files. foo.orig and foo.link are dangerous
49 FILEMERGE='/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge'
50 if type "$FILEMERGE" > /dev/null 2>&1; then
51 cp "$LOCAL.orig" "$LOCAL"
52 ln "$LOCAL" "$LOCAL.link"
53 # filemerge prefers the right by default
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"
54 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 78 fi
56 79
57 80 if [ -n "$DISPLAY" ]; then
General Comments 0
You need to be logged in to leave comments. Login now