home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / CMDS / rcs4.lha / rcsfreeze.sh (.txt) < prev    next >
Microsoft Windows Help File Content  |  1993-03-03  |  4KB  |  75 lines

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