Skip to content
Snippets Groups Projects
Commit 4338e33c authored by Brendan Cully's avatar Brendan Cully
Browse files

Safer version of FileMerge merge

parent d529cdc0
No related branches found
No related tags found
No related merge requests found
...@@ -44,14 +44,37 @@ ...@@ -44,14 +44,37 @@
cp "$LOCAL.orig" "$LOCAL" cp "$LOCAL.orig" "$LOCAL"
fi fi
# on MacOS X try opendiff # on MacOS X try FileMerge.app, shipped with Apple's developer tools
# (uses FileMerge.app, shipped with Apple's developer tools) # TODO: make proper temp files. foo.orig and foo.link are dangerous
if type opendiff > /dev/null 2>&1; then FILEMERGE='/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge'
opendiff "$LOCAL.orig" "$OTHER" -ancestor "$BASE" -merge "$LOCAL" || exit 1 if type "$FILEMERGE" > /dev/null 2>&1; then
# prevent $OTHER from being removed too early cp "$LOCAL.orig" "$LOCAL"
# can surely be done in a more elegant way ln "$LOCAL" "$LOCAL.link"
sleep 1 # filemerge prefers the right by default
exit 0 if ! "$FILEMERGE" -left "$OTHER" -right "$LOCAL" -ancestor "$BASE" -merge "$LOCAL"
then
echo "FileMerge failed to launch"
exit 1
fi
if ! test "$LOCAL" -ef "$LOCAL.link"
then
rm "$LOCAL.orig" "$LOCAL.link"
exit 0
else
rm "$LOCAL.link"
echo "$LOCAL is unchanged. Was the merge successful?"
select answer in yes no
do
if test "$answer" == "yes"
then
rm "$LOCAL.orig"
exit 0
else
exit 1
fi
done
exit 1
fi
fi fi
if [ -n "$DISPLAY" ]; then if [ -n "$DISPLAY" ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment