comparison hgmerge @ 5660:3c80ecdc1bcd

Use VISUAL in addition to EDITOR when choosing the editor to use.
author Osku Salerma <osku@iki.fi>
date Wed, 05 Dec 2007 20:40:01 +0900
parents f53d97d651f4
children
comparison
equal deleted inserted replaced
5659:3da652f2039c 5660:3c80ecdc1bcd
15 15
16 LOCAL="$1" 16 LOCAL="$1"
17 BASE="$2" 17 BASE="$2"
18 OTHER="$3" 18 OTHER="$3"
19 19
20 if [ -z "$EDITOR" ]; then 20 if [ -n "$VISUAL" ]; then
21 EDITOR="vi" 21 EDIT_PROG="$VISUAL"
22 elif [ -n "$EDITOR" ]; then
23 EDIT_PROG="$EDITOR"
24 else
25 EDIT_PROG="vi"
22 fi 26 fi
23 27
24 # find decent versions of our utilities, insisting on the GNU versions where we 28 # find decent versions of our utilities, insisting on the GNU versions where we
25 # need to 29 # need to
26 MERGE="merge" 30 MERGE="merge"
163 # Also it doesn't return good error code 167 # Also it doesn't return good error code
164 $TEST "$LOCAL" -nt "$CHGTEST" && conflicts_or_success || ask_if_merged 168 $TEST "$LOCAL" -nt "$CHGTEST" && conflicts_or_success || ask_if_merged
165 fi 169 fi
166 fi 170 fi
167 171
168 # Attempt to do a merge with $EDITOR 172 # Attempt to do a merge with $EDIT_PROG
169 if [ -n "$MERGE" -o -n "$DIFF3" ]; then 173 if [ -n "$MERGE" -o -n "$DIFF3" ]; then
170 echo "conflicts detected in $LOCAL" 174 echo "conflicts detected in $LOCAL"
171 cp "$BACKUP" "$CHGTEST" 175 cp "$BACKUP" "$CHGTEST"
172 case "$EDITOR" in 176 case "$EDIT_PROG" in
173 "emacs") 177 "emacs")
174 $EDITOR "$LOCAL" --eval '(condition-case nil (smerge-mode 1) (error nil))' || failure 178 $EDIT_PROG "$LOCAL" --eval '(condition-case nil (smerge-mode 1) (error nil))' || failure
175 ;; 179 ;;
176 *) 180 *)
177 $EDITOR "$LOCAL" || failure 181 $EDIT_PROG "$LOCAL" || failure
178 ;; 182 ;;
179 esac 183 esac
180 # Some editors do not return meaningful error codes 184 # Some editors do not return meaningful error codes
181 # Do not take any chances 185 # Do not take any chances
182 $TEST "$LOCAL" -nt "$CHGTEST" && conflicts_or_success || ask_if_merged 186 $TEST "$LOCAL" -nt "$CHGTEST" && conflicts_or_success || ask_if_merged
193 $DIFF -u "$BASE" "$OTHER" > "$HGTMP/diff" || : 197 $DIFF -u "$BASE" "$OTHER" > "$HGTMP/diff" || :
194 if $PATCH "$LOCAL" < "$HGTMP/diff"; then 198 if $PATCH "$LOCAL" < "$HGTMP/diff"; then
195 success 199 success
196 else 200 else
197 # If rejects are empty after using the editor, merge was ok 201 # If rejects are empty after using the editor, merge was ok
198 $EDITOR "$LOCAL" "$LOCAL.rej" || failure 202 $EDIT_PROG "$LOCAL" "$LOCAL.rej" || failure
199 $TEST -s "$LOCAL.rej" || success 203 $TEST -s "$LOCAL.rej" || success
200 fi 204 fi
201 failure 205 failure
202 fi 206 fi
203 207