mergemaster (was Re: Meeting/Flooding/Lists)

Jonathan Belson jon at witchspace.com
Mon Aug 12 19:28:34 BST 2002


This is a multi-part message in MIME format.
--------------090205000506090207020100
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hiya


ISTR someone at the meeting commenting on mergemaster being a bit of a
pain to use...

My eyes soon get fatigued by all that scrolling text, which can make it
difficult to figure out which files are being compared with which.  If
it's a file I know I've never touched then I can just over write it
without checking, which speeds up the comparing  process.

Here's a slightly underwhelming patch which improves things a bit - all
I do is display important text in bold.  I added a couple of routines
for colour too, but I didn't really like the results; maybe someone
else can have a play.  You will have to set your PAGER to something
like 'less -R' otherwise the control codes will be printed literally.
(Come to think of it, it could probably be done in the script itself)

Hope someone else finds it useful,


--Jon

http://www.witchspace.com

--------------090205000506090207020100
Content-Type: text/plain;
 name="mergemaster.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mergemaster.diff"

--- /usr/sbin/mergemaster	Sun Jul 28 16:48:26 2002
+++ mergemaster	Mon Aug 12 19:05:58 2002
@@ -44,6 +44,27 @@
   echo '* The -a option causes mergemaster to run without prompting.'
 }
 
+fg_bold () {
+	echo ""
+}
+
+fg_normal () {
+	echo ""
+}
+
+fg_white () {
+	echo ""
+
+}
+
+fg_blue () {
+	echo ""
+}
+
+fg_red () {
+	echo ""
+}
+
 # Loop allowing the user to use sdiff to merge files and display the merged
 # file.
 merge_loop () {
@@ -116,15 +137,18 @@
 	echo ''
         (
           echo ''
+          fg_bold
           echo "  *** Displaying differences between ${COMPFILE} and installed version:"
-          echo ''
+          fg_normal
           diff "${DIFF_FLAG}" "${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
         ) | ${PAGER}
         echo ''
       fi
     else
       echo ''
+      fg_bold
       echo "  *** There is no installed version of ${COMPFILE}"
+      fg_normal
       echo ''
       case "${AUTO_INSTALL}" in
       [Yy][Ee][Ss])
@@ -136,7 +160,9 @@
           AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES}      ${DESTDIR}${COMPFILE#.}
 "
         else
+          fg_bold
           echo "   *** Problem installing ${COMPFILE}, it will remain to merge by hand"
+          fg_normal
         fi
         return
         ;;
@@ -146,6 +172,7 @@
       esac
     fi
 
+    fg_bold
     echo "  Use 'd' to delete the temporary ${COMPFILE}"
     echo "  Use 'i' to install the temporary ${COMPFILE}"
     case "${NO_INSTALLED}" in
@@ -158,20 +185,27 @@
     echo "  Default is to leave the temporary file to deal with by hand"
     echo ''
     echo -n "How should I deal with this? [Leave it for later] "
+    fg_normal
     read HANDLE_COMPFILE
 
     case "${HANDLE_COMPFILE}" in
     [dD])
       rm "${COMPFILE}"
       echo ''
+      fg_bold
       echo "   *** Deleting ${COMPFILE}"
+      fg_normal
       ;;
     [iI])
       echo ''
       if mm_install "${COMPFILE}"; then
+        fg_bold
         echo "   *** ${COMPFILE} installed successfully"
+        fg_normal
       else
+        fg_bold
         echo "   *** Problem installing ${COMPFILE}, it will remain to merge by hand"
+        fg_normal
       fi
       ;;
     [mM])
@@ -182,7 +216,9 @@
         ;;
       *)
         echo ''
+        fg_bold
         echo "   *** There is no installed version of ${COMPFILE}"
+        fg_normal
         echo ''
         HANDLE_COMPFILE="NOT V"
         ;;
@@ -197,8 +233,10 @@
       ;;
     *)
       # invalid choice, show menu again.
+      fg_bold
       echo "invalid choice: ${HANDLE_COMPFILE}"
       echo ''
+      fg_normal
       HANDLE_COMPFILE="NOT V"
       continue
       ;;
@@ -411,6 +449,7 @@
   TEST_TEMP_ROOT=yes
   while [ "${TEST_TEMP_ROOT}" = "yes" ]; do
     if [ -d "${TEMPROOT}" ]; then
+      fg_bold
       echo "*** The directory specified for the temporary root environment,"
       echo "    ${TEMPROOT}, exists.  This can be a security risk if untrusted"
       echo "    users have access to the system."
@@ -455,6 +494,7 @@
         esac
         ;;
       *)
+        fg_normal
         # If this is an auto-run, try a hopefully safe alternative then
         # re-test anyway.
         TEMPROOT=/var/tmp/temproot.`date +%m%d.%H.%M.%S`
@@ -465,21 +505,29 @@
     fi
   done
 
+  fg_bold
   echo "*** Creating the temporary root environment in ${TEMPROOT}"
+  fg_normal
 
   if mkdir -p "${TEMPROOT}"; then
+    fg_bold
     echo " *** ${TEMPROOT} ready for use"
+    fg_normal
   fi
 
   if [ ! -d "${TEMPROOT}" ]; then
     echo ''
+    fg_bold
     echo "  *** FATAL ERROR: Cannot create ${TEMPROOT}"
     echo ''
+    fg_normal
     exit 1
   fi
 
+  fg_bold
   echo " *** Creating and populating directory structure in ${TEMPROOT}"
   echo ''
+  fg_normal
 
   case "${VERBOSE}" in
   '') ;;
@@ -502,8 +550,10 @@
       make MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj DESTDIR=${TEMPROOT} \
           -DNO_MAKEDEV_RUN distribution;} ||
     { echo '';
+      fg_bold
      echo "  *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to";
       echo "      the temproot environment";
+      fg_normal
       echo '';
       exit 1;}
     ;;
@@ -825,7 +875,9 @@
 done # This is for the do way up there at the beginning of the comparison
 
 echo ''
+fg_bold
 echo "*** Comparison complete"
+fg_normal
 echo ''
 
 TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null`
@@ -837,7 +889,9 @@
 
 case "${AUTO_RUN}" in
 '')
+  fg_bold
   echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] "
+  fg_normal
   read DEL_TEMPROOT
 
   case "${DEL_TEMPROOT}" in
@@ -863,16 +917,20 @@
   '')
     (
       echo ''
+      fg_bold
       echo '*** You chose the automatic install option for files that did not'
       echo '    exist on your system.  The following were installed for you:'
       echo "${AUTO_INSTALLED_FILES}"
+      fg_normal
     ) | ${PAGER}
     ;;
   *)
     echo ''
+    fg_bold
     echo '*** You chose the automatic install option for files that did not'
     echo '    exist on your system.  The following were installed for you:'
     echo "${AUTO_INSTALLED_FILES}"
+    fg_normal
     ;;
   esac
   ;;

--------------090205000506090207020100--





More information about the Ukfreebsd mailing list