diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2008-12-16 22:23:56 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2008-12-16 22:23:56 +0000 |
commit | 7893d74eb052e5b3c3dee8214f081ed3553fa557 (patch) | |
tree | c77d4d21168f9ab2de4e34afc5a7f3039f7e53d9 /usr.sbin/sysmerge/sysmerge.sh | |
parent | f0c07518885c268a5738174d4502529dc178af9a (diff) |
- make it possible to edit a merged file using an external editor ;
useful when 'sdiff eb' does not cope with one's needs.
idea and input from weerd@
ok weerd@ sthen@
Diffstat (limited to 'usr.sbin/sysmerge/sysmerge.sh')
-rw-r--r-- | usr.sbin/sysmerge/sysmerge.sh | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh index 79c9dad746e..99e92542b4f 100644 --- a/usr.sbin/sysmerge/sysmerge.sh +++ b/usr.sbin/sysmerge/sysmerge.sh @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: sysmerge.sh,v 1.26 2008/12/15 15:54:55 fgsch Exp $ +# $OpenBSD: sysmerge.sh,v 1.27 2008/12/16 22:23:55 ajacoutot Exp $ # # This script is based on the FreeBSD mergemaster script, written by # Douglas Barton <DougB@FreeBSD.org> @@ -28,9 +28,11 @@ umask 0022 WRKDIR=`mktemp -d -p /var/tmp sysmerge.XXXXX` || exit 1 SWIDTH=`stty size | awk '{w=$2} END {if (w==0) {w=80} print w}'` -PAGER="${PAGER:=/usr/bin/more}" MERGE_CMD="${MERGE_CMD:=sdiff -as -w ${SWIDTH} -o}" +EDITOR="${EDITOR:=/usr/bin/vi}" +PAGER="${PAGER:=/usr/bin/more}" + # clean leftovers created by make in src clean_src() { if [ "${SRCDIR}" ]; then @@ -204,7 +206,8 @@ merge_loop() { INSTALL_MERGED=v while [ "${INSTALL_MERGED}" = "v" ]; do echo "" - echo " Use 'i' to install merged file" + echo " Use 'e' to edit the merged file" + echo " Use 'i' to install the merged file" echo " Use 'n' to view a diff between the merged and new files" echo " Use 'o' to view a diff between the old and merged files" echo " Use 'r' to re-do the merge" @@ -214,6 +217,20 @@ merge_loop() { echo -n "===> How should I deal with the merged file? [Leave it for later] " read INSTALL_MERGED case "${INSTALL_MERGED}" in + [eE]) + echo "editing merged file...\n" + if [ -z "${VISUAL}" ]; then + EDIT="${EDITOR}" + else + EDIT="${VISUAL}" + fi + if which ${EDIT} > /dev/null 2>&1; then + ${EDIT} ${COMPFILE}.merged + else + echo " *** ERROR: ${EDIT} can not be found or is not executable" + fi + INSTALL_MERGED=v + ;; [iI]) mv "${COMPFILE}.merged" "${COMPFILE}" echo "" |