home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / rcs / rcsfreez.cmd < prev    next >
OS/2 REXX Batch file  |  1992-02-23  |  3KB  |  87 lines

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