3 # rcsfreeze - assign a symbolic revision number to a configuration of RCS files
5 # $FreeBSD: src/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh,v 1.8.2.1 2001/03/05 13:08:40 ru Exp $
6 # $DragonFly: src/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh,v 1.2 2003/06/17 04:25:48 dillon Exp $
8 # The idea is to run rcsfreeze each time a new version is checked
9 # in. A unique symbolic revision number (C_[number], where number
10 # is increased each time rcsfreeze is run) is then assigned to the most
11 # recent revision of each RCS file of the main trunk.
13 # If the command is invoked with an argument, then this
14 # argument is used as the symbolic name to freeze a configuration.
15 # The unique identifier is still generated
16 # and is listed in the log file but it will not appear as
17 # part of the symbolic revision name in the actual RCS file.
19 # A log message is requested from the user which is saved for future
22 # The shell script works only on all RCS files at one time.
23 # It is important that all changed files are checked in (there are
24 # no precautions against any error in this respect).
26 # {RCS/}.rcsfreeze.ver version number
27 # {RCS/}.rscfreeze.log log messages, most recent first
29 PATH=/bin:/usr/bin:$PATH
32 DATE=`LC_ALL=C date` || exit
33 # Check whether we have an RCS subdirectory, so we can have the right
34 # prefix for our paths.
40 # Version number stuff, log message file
41 VERSIONFILE=${RCSDIR}.rcsfreeze.ver
42 LOGFILE=${RCSDIR}.rcsfreeze.log
43 # Initialize, rcsfreeze never run before in the current directory
44 test -r $VERSIONFILE || { echo 0 >$VERSIONFILE && >>$LOGFILE; } || exit
46 # Get Version number, increase it, write back to file.
47 VERSIONNUMBER=`cat $VERSIONFILE` &&
48 VERSIONNUMBER=`expr $VERSIONNUMBER + 1` &&
49 echo $VERSIONNUMBER >$VERSIONFILE || exit
51 # Symbolic Revision Number
52 SYMREV=C_$VERSIONNUMBER
53 # Allow the user to give a meaningful symbolic name to the revision.
54 SYMREVNAME=${1-$SYMREV}
55 echo >&2 "rcsfreeze: symbolic revision number computed: \"${SYMREV}\"
56 rcsfreeze: symbolic revision number used: \"${SYMREVNAME}\"
57 rcsfreeze: the two differ only when rcsfreeze invoked with argument
58 rcsfreeze: give log message, summarizing changes (end with EOF or single '.')" \
61 # Stamp the logfile. Because we order the logfile the most recent
62 # first we will have to save everything right now in a temporary file.
64 trap 'rm -f $TMPLOG; exit 1' 1 2 13 15
65 # Now ask for a log message, continously add to the log file
67 echo "Version: $SYMREVNAME($SYMREV), Date: $DATE
81 # combine old and new logfiles
82 cp $TMPLOG $LOGFILE &&
85 # Now the real work begins by assigning a symbolic revision number
86 # to each rcs file. Take the most recent version on the default branch.
88 # If there are any .*,v files, throw them in too.
89 # But ignore RCS/.* files that do not end in ,v.
91 for DOTFILE in ${RCSDIR}.*,v
95 DOTFILES="${RCSDIR}.*,v"
100 exec rcs -q -n$SYMREVNAME: ${RCSDIR}*$EXT $DOTFILES