Show More
@@ -17,21 +17,32 b' fi' | |||||
17 |
|
17 | |||
18 | # find decent versions of our utilities, insisting on the GNU versions where we |
|
18 | # find decent versions of our utilities, insisting on the GNU versions where we | |
19 | # need to |
|
19 | # need to | |
|
20 | MERGE=merge | |||
20 | DIFF3=gdiff3 |
|
21 | DIFF3=gdiff3 | |
21 | DIFF=gdiff |
|
22 | DIFF=gdiff | |
22 | PATCH=gpatch |
|
23 | PATCH=gpatch | |
23 |
|
24 | |||
|
25 | type $MERGE >/dev/null 2>&1 || MERGE= | |||
24 | type $DIFF3 >/dev/null 2>&1 || DIFF3=diff3 |
|
26 | type $DIFF3 >/dev/null 2>&1 || DIFF3=diff3 | |
25 | type $DIFF >/dev/null 2>&1 || DIFF=diff |
|
27 | type $DIFF >/dev/null 2>&1 || DIFF=diff | |
26 |
type $PATCH |
|
28 | type $PATCH >/dev/null 2>&1 || PATCH=patch | |
27 | $DIFF3 --version >/dev/null 2>&1 || DIFF3= |
|
29 | $DIFF3 --version >/dev/null 2>&1 || DIFF3= | |
28 |
|
30 | |||
|
31 | # find optional visual utilities | |||
|
32 | FILEMERGE='/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge' | |||
|
33 | KDIFF3=kdiff3 | |||
|
34 | TKDIFF=tkdiff | |||
|
35 | ||||
|
36 | type $FILEMERGE >/dev/null 2>&1 || FILEMERGE= | |||
|
37 | type $KDIFF3 >/dev/null 2>&1 || KDIFF3= | |||
|
38 | type $TKDIFF >/dev/null 2>&1 || TKDIFF= | |||
|
39 | ||||
29 | # Back up our file |
|
40 | # Back up our file | |
30 | cp "$LOCAL" "$LOCAL.orig" |
|
41 | cp "$LOCAL" "$LOCAL.orig" | |
31 |
|
42 | |||
32 | # Attempt to do a non-interactive merge |
|
43 | # Attempt to do a non-interactive merge | |
33 | if type merge > /dev/null 2>&1; then |
|
44 | if [ -n "$MERGE" ]; then | |
34 |
|
|
45 | $MERGE "$LOCAL" "$BASE" "$OTHER" 2> /dev/null && exit 0 | |
35 | cp "$LOCAL.orig" "$LOCAL" |
|
46 | cp "$LOCAL.orig" "$LOCAL" | |
36 | elif [ -n "$DIFF3" ]; then |
|
47 | elif [ -n "$DIFF3" ]; then | |
37 | echo $DIFF3 -m "$LOCAL.orig" "$BASE" "$OTHER" |
|
48 | echo $DIFF3 -m "$LOCAL.orig" "$BASE" "$OTHER" | |
@@ -46,8 +57,8 b' fi' | |||||
46 |
|
57 | |||
47 | # on MacOS X try FileMerge.app, shipped with Apple's developer tools |
|
58 | # 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 |
|
59 | # TODO: make proper temp files. foo.orig and foo.link are dangerous | |
49 | FILEMERGE='/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge' |
|
60 | ||
50 |
if |
|
61 | if [ -n "$FILEMERGE" ]; then | |
51 | cp "$LOCAL.orig" "$LOCAL" |
|
62 | cp "$LOCAL.orig" "$LOCAL" | |
52 | ln "$LOCAL" "$LOCAL.link" |
|
63 | ln "$LOCAL" "$LOCAL.link" | |
53 | # filemerge prefers the right by default |
|
64 | # filemerge prefers the right by default | |
@@ -79,22 +90,22 b' fi' | |||||
79 |
|
90 | |||
80 | if [ -n "$DISPLAY" ]; then |
|
91 | if [ -n "$DISPLAY" ]; then | |
81 | # try using kdiff3, which is fairly nice |
|
92 | # try using kdiff3, which is fairly nice | |
82 | if type kdiff3 > /dev/null 2>&1; then |
|
93 | if [ -n "$KDIFF3" ]; then | |
83 |
|
|
94 | $KDIFF3 --auto "$BASE" "$LOCAL" "$OTHER" -o "$LOCAL" || exit 1 | |
84 | exit 0 |
|
95 | exit 0 | |
85 | fi |
|
96 | fi | |
86 |
|
97 | |||
87 | # try using tkdiff, which is a bit less sophisticated |
|
98 | # try using tkdiff, which is a bit less sophisticated | |
88 | if type tkdiff > /dev/null 2>&1; then |
|
99 | if [ -n "$TKDIFF" ]; then | |
89 |
|
|
100 | $TKDIFF "$LOCAL" "$OTHER" -a "$BASE" -o "$LOCAL" || exit 1 | |
90 | exit 0 |
|
101 | exit 0 | |
91 | fi |
|
102 | fi | |
92 | fi |
|
103 | fi | |
93 |
|
104 | |||
94 | # Attempt to do a merge with $EDITOR |
|
105 | # Attempt to do a merge with $EDITOR | |
95 | if type merge > /dev/null 2>&1; then |
|
106 | if [ -n "$MERGE" ]; then | |
96 | echo "conflicts detected in $LOCAL" |
|
107 | echo "conflicts detected in $LOCAL" | |
97 |
|
|
108 | $MERGE "$LOCAL" "$BASE" "$OTHER" 2>/dev/null || $EDITOR "$LOCAL" | |
98 | exit 0 |
|
109 | exit 0 | |
99 | fi |
|
110 | fi | |
100 |
|
111 |
General Comments 0
You need to be logged in to leave comments.
Login now