44 |
44 |
45 type "$FILEMERGE" >/dev/null 2>&1 || FILEMERGE= |
45 type "$FILEMERGE" >/dev/null 2>&1 || FILEMERGE= |
46 type "$KDIFF3" >/dev/null 2>&1 || KDIFF3= |
46 type "$KDIFF3" >/dev/null 2>&1 || KDIFF3= |
47 type "$TKDIFF" >/dev/null 2>&1 || TKDIFF= |
47 type "$TKDIFF" >/dev/null 2>&1 || TKDIFF= |
48 type "$MELD" >/dev/null 2>&1 || MELD= |
48 type "$MELD" >/dev/null 2>&1 || MELD= |
|
49 |
|
50 # Hack for Solaris |
|
51 TEST="/usr/bin/test" |
|
52 type "$TEST" >/dev/null 2>&1 || TEST="/bin/test" |
|
53 type "$TEST" >/dev/null 2>&1 || TEST="test" |
49 |
54 |
50 # random part of names |
55 # random part of names |
51 RAND="$RANDOM$RANDOM" |
56 RAND="$RANDOM$RANDOM" |
52 |
57 |
53 # temporary directory for diff+patch merge |
58 # temporary directory for diff+patch merge |
116 cp "$BACKUP" "$LOCAL" |
121 cp "$BACKUP" "$LOCAL" |
117 cp "$BACKUP" "$CHGTEST" |
122 cp "$BACKUP" "$CHGTEST" |
118 # filemerge prefers the right by default |
123 # filemerge prefers the right by default |
119 $FILEMERGE -left "$OTHER" -right "$LOCAL" -ancestor "$BASE" -merge "$LOCAL" |
124 $FILEMERGE -left "$OTHER" -right "$LOCAL" -ancestor "$BASE" -merge "$LOCAL" |
120 [ $? -ne 0 ] && echo "FileMerge failed to launch" && failure |
125 [ $? -ne 0 ] && echo "FileMerge failed to launch" && failure |
121 test "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged |
126 $TEST "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged |
122 fi |
127 fi |
123 |
128 |
124 if [ -n "$DISPLAY" ]; then |
129 if [ -n "$DISPLAY" ]; then |
125 # try using kdiff3, which is fairly nice |
130 # try using kdiff3, which is fairly nice |
126 if [ -n "$KDIFF3" ]; then |
131 if [ -n "$KDIFF3" ]; then |
140 cp "$BACKUP" "$LOCAL.tmp.$RAND" |
145 cp "$BACKUP" "$LOCAL.tmp.$RAND" |
141 # Meld doesn't have automatic merging, so to reduce intervention |
146 # Meld doesn't have automatic merging, so to reduce intervention |
142 # use the file with conflicts |
147 # use the file with conflicts |
143 $MELD "$LOCAL.tmp.$RAND" "$LOCAL" "$OTHER" || failure |
148 $MELD "$LOCAL.tmp.$RAND" "$LOCAL" "$OTHER" || failure |
144 # Also it doesn't return good error code |
149 # Also it doesn't return good error code |
145 test "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged |
150 $TEST "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged |
146 fi |
151 fi |
147 fi |
152 fi |
148 |
153 |
149 # Attempt to do a merge with $EDITOR |
154 # Attempt to do a merge with $EDITOR |
150 if [ -n "$MERGE" -o -n "$DIFF3" ]; then |
155 if [ -n "$MERGE" -o -n "$DIFF3" ]; then |
151 echo "conflicts detected in $LOCAL" |
156 echo "conflicts detected in $LOCAL" |
152 cp "$BACKUP" "$CHGTEST" |
157 cp "$BACKUP" "$CHGTEST" |
153 $EDITOR "$LOCAL" || failure |
158 $EDITOR "$LOCAL" || failure |
154 # Some editors do not return meaningful error codes |
159 # Some editors do not return meaningful error codes |
155 # Do not take any chances |
160 # Do not take any chances |
156 test "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged |
161 $TEST "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged |
157 fi |
162 fi |
158 |
163 |
159 # attempt to manually merge with diff and patch |
164 # attempt to manually merge with diff and patch |
160 if [ -n "$DIFF" -a -n "$PATCH" ]; then |
165 if [ -n "$DIFF" -a -n "$PATCH" ]; then |
161 |
166 |