Annotation of 43BSDTahoe/new/rcs/src/rcsfreeze.sh, revision 1.1.1.1

1.1       root        1: #! /bin/sh
                      2: PATH=/usr/local/bin:/bin:/usr/bin:/usr/ucb
                      3: #       'rcsfreeze' has the purpose of assigning a symbolic revision
                      4: #       number to a set of RCS files, which form a valid configuration.
                      5: #
                      6: #       The idea is to run rcsfreeze each time a new version is checked
                      7: #       in. A unique symbolic revision number (C_[number], where number
                      8: #       is increased each time rcsfreeze is run) is then assigned to the most
                      9: #       recent revision of each RCS file of the main trunk.
                     10: #
                     11: #       If the command is invoked with an argument, then this
                     12: #       argument is used as the symbolic name to freeze a configuration.
                     13: #       The unique identifier is still generated
                     14: #       and is listed in the log file but it will not appear as
                     15: #       part of the symbolic revision name in the actual RCS file.
                     16: #
                     17: #       A log message is requested from the user which is saved for future
                     18: #       references.
                     19: #
                     20: #       The shell script works only on all RCS files at one time.
                     21: #       It is important that all changed files are checked in (there are
                     22: #       no precautions against any error in this respect).
                     23: #       file names:
                     24: #       {RCS/}rcsfreeze.version         for the version number
                     25: #       {RCS/}rscfreeze.log             for the log messages, most recent
                     26: #                                       logmessage first.
                     27: 
                     28: progname=`basename $0`
                     29: DATE=`date`
                     30: # Check whether we have an RCS subdirectory, so we can have the right
                     31: # prefix for our paths.
                     32: if [ -d RCS ] ; then
                     33:        RCSDIR=RCS
                     34: else
                     35:        RCSDIR=.
                     36: fi
                     37: 
                     38: # Version number stuff, log message file
                     39: VERSIONFILE=$RCSDIR/.rcsfreeze.version
                     40: LOGFILE=$RCSDIR/.rcsfreeze.log
                     41: if [ ! -r $VERSIONFILE ] ; then
                     42: # Initialize, rcsfreeze never run before in the current directory
                     43:     cat << EOF > $VERSIONFILE
                     44: 0
                     45: EOF
                     46:     touch       $LOGFILE
                     47: fi
                     48: 
                     49: # Get Version number, increase it, write back to file.
                     50: VERSIONNUMBER=`cat $VERSIONFILE`
                     51: VERSIONNUMBER=`expr $VERSIONNUMBER + 1`
                     52:     cat << EOF > $VERSIONFILE
                     53: $VERSIONNUMBER
                     54: EOF
                     55: 
                     56: # Symbolic Revision Number
                     57: SYMREV=C_$VERSIONNUMBER
                     58: # Allow the user to give a meaningful symbolic name to the revision.
                     59: SYMREVNAME=${1-$SYMREV}
                     60: echo    "$progname: symbolic revision number computed: \"$SYMREV\""
                     61: echo    "$progname: symbolic revision number used:     \"$SYMREVNAME\""
                     62: echo    "$progname: the two differ only when $progname invoked with argument"
                     63: 
                     64: # Stamp the logfile. Because we order the logfile the most recent
                     65: # first we will have to save everything right now in a temporary file.
                     66: TMPLOG=/tmp/rcsfreeze.$$.log.tmp
                     67: echo "Version: $SYMREVNAME($SYMREV), Date: $DATE"     > $TMPLOG
                     68: echo "-----------"                      >> $TMPLOG
                     69: # Now ask for a log message, continously add to the log file
                     70: echo    "$progname: give log message, summarizing changes"
                     71: echo    "       (terminate with ^D or single '.')"
                     72: while read MESS ; do
                     73:     if [ "$MESS" = '.' ] ; then break ; fi
                     74:     echo "  $MESS"      >> $TMPLOG
                     75: done
                     76: echo "-----------"                      >> $TMPLOG
                     77: echo                                    >> $TMPLOG
                     78: 
                     79: # combine old and new logfiles
                     80: TMPLOG2=$TMPLOG.2
                     81: cat $TMPLOG $LOGFILE >  $TMPLOG2
                     82: cp $TMPLOG2     $LOGFILE
                     83: rm -f  $TMPLOG $TMPLOG2
                     84: 
                     85: # Now the real work begins by assigning a symbolic revision number
                     86: # to each rcs file. Take the most recent version of the main trunk.
                     87: 
                     88: for FILE in $RCSDIR/* ; do
                     89: #   get the revision number of the most recent revision
                     90:     REV=`rlog -h -d"$DATE" $FILE | fgrep 'head:' | awk ' { print $2 } ' `
                     91:     echo        "$progname: file name: \"$FILE\", Revision Number: $REV"
                     92: #   assign symbolic name to it.
                     93:     rcs -q -n$SYMREVNAME:$REV $FILE
                     94: done

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.