Mercurial > hg > mercurial-crew-with-dirclash
comparison hgmerge @ 2051:6a03cff2b0f5 0.8.1
Try to use /usr/bin/test or /bin/test to work around missing features.
The builtin "test" of Solaris 8 /bin/sh doesn't understand -nt.
author | Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> |
---|---|
date | Fri, 07 Apr 2006 22:31:54 +0200 |
parents | c4d577262d00 |
children | e4480f2b61e9 |
comparison
equal
deleted
inserted
replaced
2050:e49d0fa38176 | 2051:6a03cff2b0f5 |
---|---|
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 |
168 if $PATCH "$LOCAL" < "$HGTMP/diff"; then | 173 if $PATCH "$LOCAL" < "$HGTMP/diff"; then |
169 success | 174 success |
170 else | 175 else |
171 # If rejects are empty after using the editor, merge was ok | 176 # If rejects are empty after using the editor, merge was ok |
172 $EDITOR "$LOCAL" "$LOCAL.rej" || failure | 177 $EDITOR "$LOCAL" "$LOCAL.rej" || failure |
173 test -s "$LOCAL.rej" || success | 178 $TEST -s "$LOCAL.rej" || success |
174 fi | 179 fi |
175 failure | 180 failure |
176 fi | 181 fi |
177 | 182 |
178 echo | 183 echo |