Mercurial > public > mercurial-scm > hg
diff 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 |
line wrap: on
line diff
--- a/hgmerge Tue Dec 18 14:01:42 2007 -0600 +++ b/hgmerge Wed Dec 05 20:40:01 2007 +0900 @@ -17,8 +17,12 @@ BASE="$2" OTHER="$3" -if [ -z "$EDITOR" ]; then - EDITOR="vi" +if [ -n "$VISUAL" ]; then + EDIT_PROG="$VISUAL" +elif [ -n "$EDITOR" ]; then + EDIT_PROG="$EDITOR" +else + EDIT_PROG="vi" fi # find decent versions of our utilities, insisting on the GNU versions where we @@ -165,16 +169,16 @@ fi fi -# Attempt to do a merge with $EDITOR +# Attempt to do a merge with $EDIT_PROG if [ -n "$MERGE" -o -n "$DIFF3" ]; then echo "conflicts detected in $LOCAL" cp "$BACKUP" "$CHGTEST" - case "$EDITOR" in + case "$EDIT_PROG" in "emacs") - $EDITOR "$LOCAL" --eval '(condition-case nil (smerge-mode 1) (error nil))' || failure + $EDIT_PROG "$LOCAL" --eval '(condition-case nil (smerge-mode 1) (error nil))' || failure ;; *) - $EDITOR "$LOCAL" || failure + $EDIT_PROG "$LOCAL" || failure ;; esac # Some editors do not return meaningful error codes @@ -195,7 +199,7 @@ success else # If rejects are empty after using the editor, merge was ok - $EDITOR "$LOCAL" "$LOCAL.rej" || failure + $EDIT_PROG "$LOCAL" "$LOCAL.rej" || failure $TEST -s "$LOCAL.rej" || success fi failure