Date: Mon, 14 Oct 2002 15:14:11 -0700 (PDT) From: Matthew Dillon <dillon@apollo.backplane.com> To: Garance A Drosihn <drosih@rpi.edu> Cc: "Crist J. Clark" <crist.clark@attbi.com>, Trish Lynch <trish@bsdunix.net>, Adrian Wontroba <aw1@stade.co.uk>, chris scott <c.scott@uk.tiscali.com>, freebsd-stable@FreeBSD.ORG Subject: Re: Some Changes to Mergemaster Message-ID: <200210142214.g9EMEBPm005321@apollo.backplane.com> References: <20021013172810.A19177@titus.hanley.stade.co.uk> <20021013130138.G523-100000@femme.sapphite.org> <20021013214642.GB90169@blossom.cjclark.org> <200210132154.g9DLsUmc057065@apollo.backplane.com> <20021013225509.GA90575@blossom.cjclark.org> <200210140228.g9E2SRlA058696@apollo.backplane.com> <p05111701b9d0ed042c5f@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
:Apologies for simply repeating Matt's message, but there are plenty :of people interested in mergemaster who would not even glance at :the discussion about : 'Ifconfig config of gif tunnels', :and a subject of : 'Patch #2 (Re: Ifconfig config of gif tunnels)' :did not strike me as being all that much better... Heh. Yes, absolutely right. Here is my current patch set (patch #3) to mergemaster. It implements the following: (1) clears the terminal window for each presentation. This places all the information in obvious easy to find (deterministic) placement on the screen. Before you could wind up with the information in odd places on the screen depending on the size of the file and whether it was a new file or a diff set. I can run through a mergemaster about twice as fast with this change then I could before. >> debate issue, scrollback buffer for xterm to see what happened before. (2) Initial diff does not use the pager and chops it to fit on a single screen. This fixes the problem where you would sometimes be left in the pager and sometimes not be left in the pager, depending on the size of the diff, making it difficult to quickly run through the vast majority of mergemaster files that you would normally just replace, e.g. /etc/defaults/*, /etc/rc* (for most people) and do not need to see the full diff. Other possible improvements that could be done (not implemented in this patch) include checking the file against previous CVS revs and having a list of 'always replace' files, typically /etc/rc* and /etc/defaults/* (for example), possibly enabled via a switch. This patch is against -stable. I know the stty size tests are messy but it's the safest way I can think of to figure out the terminal dimensions. (I would commit to -current first, of course). (I just added the test -t at the beginning relative to patch #2). -Matt Index: mergemaster.sh =================================================================== RCS file: /home/ncvs/src/usr.sbin/mergemaster/mergemaster.sh,v retrieving revision 1.6.2.14 diff -u -r1.6.2.14 mergemaster.sh --- mergemaster.sh 30 Jun 2002 19:01:35 -0000 1.6.2.14 +++ mergemaster.sh 14 Oct 2002 02:33:35 -0000 @@ -12,6 +12,30 @@ PATH=/bin:/usr/bin:/usr/sbin +# Figure out the number of columns and rows on the +# terminal. Use 80x24 if there is any doubt. +# +if test -t 0; then + DIFFROWS=`stty size | awk '{ print $1; }'` + DIFFCOLS=`stty size | awk '{ print $2; }'` + if [ -z "$DIFFCOLS" ]; then + DIFFCOLS=80 + fi + if [ -z "$DIFFROWS" ]; then + DIFFROWS=24 + fi + if [ $DIFFROWS -le 0 ]; then + DIFFROWS=24 + fi + if [ $DIFFCOLS -le 0 ]; then + DIFFCOLS=80 + fi +else + DIFFCOLS=80 + DIFFROWS=24 +fi +DIFFROWS=$(($DIFFROWS - 8)) +DIFFCOLS=$(($DIFFCOLS - 1)) display_usage () { VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` echo "mergemaster version ${VERSION_NUMBER}" @@ -106,24 +130,34 @@ diff_loop () { HANDLE_COMPFILE=v + FIRST_TIME=y while [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" -o \ "${HANDLE_COMPFILE}" = "NOT V" ]; do if [ -f "${DESTDIR}${COMPFILE#.}" -a -f "${COMPFILE}" ]; then if [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" ]; then + if [ "$FIRST_TIME" = "y" ]; then + clear + ( + echo " *** Displaying differences between ${COMPFILE} and installed version:" + echo '' + diff "${DIFF_FLAG}" "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" + ) | cut -b 1-${DIFFCOLS} | head -${DIFFROWS} + echo '...' + else + clear + ( + echo " *** Displaying differences between ${COMPFILE} and installed version:" + echo '' + diff "${DIFF_FLAG}" "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" + ) | ${PAGER} + echo '...' + fi echo '' - echo ' ====================================================================== ' - echo '' - ( - echo '' - echo " *** Displaying differences between ${COMPFILE} and installed version:" - echo '' - diff "${DIFF_FLAG}" "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" - ) | ${PAGER} - echo '' + FIRST_TIME=n fi else - echo '' + clear echo " *** There is no installed version of ${COMPFILE}" echo '' case "${AUTO_INSTALL}" in To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210142214.g9EMEBPm005321>