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 | |
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')
-rw-r--r-- | usr.sbin/sysmerge/sysmerge.8 | 7 | ||||
-rw-r--r-- | usr.sbin/sysmerge/sysmerge.sh | 23 |
2 files changed, 24 insertions, 6 deletions
diff --git a/usr.sbin/sysmerge/sysmerge.8 b/usr.sbin/sysmerge/sysmerge.8 index e1ca611bec9..17db83108ba 100644 --- a/usr.sbin/sysmerge/sysmerge.8 +++ b/usr.sbin/sysmerge/sysmerge.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysmerge.8,v 1.11 2008/09/12 13:31:59 ajacoutot Exp $ +.\" $OpenBSD: sysmerge.8,v 1.12 2008/12/16 22:23:55 ajacoutot Exp $ .\" .\" Copyright (c) 2008 Antoine Jacoutot <ajacoutot@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 12 2008 $ +.Dd $Mdocdate: December 16 2008 $ .Dt SYSMERGE 8 .Os .Sh NAME @@ -110,7 +110,8 @@ mode. .Nm will work through the fileset, offering the chance to merge any differences -using ${MERGE_CMD}. +using ${MERGE_CMD} as well as edit the merged file with your favorite +editor defined by the ${VISUAL} or ${EDITOR} environment variables. Files may also be left to deal with at a later date. Should any problems occur, such as a failure to upgrade a file, 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 "" |