#!/bin/sh # # usage: snap [-o DEST] [-d] NAME # # Make a snapshot of the current state of all RCS files under the current # directory. The snapshot is called NAME. # # $Id: rcs-snap,v 1.1 1998/10/02 10:06:44 john Exp $ opt_output=0 opt_delete=0 while getopts o:d c; do case $c in o) opt_output=${OPTARG} # If the directory has a trailing /, remove it case ${opt_output} in */) opt_output=`echo ${opt_output} | sed -e 's:/$::'` ;; esac ;; d) opt_delete=1 ;; \?) echo "usage: snap [-o DEST] [-d] NAME"; exit 0 ;; esac done shift `expr $OPTIND - 1` name=$1 if [ -z "${name}" ]; then echo "No NAME specified" exit 1 fi if [ ${opt_output} != 0 ]; then # Output revision $name of all RCS files under the current directory # to the directory $opt_output [ ! -d ${opt_output} ] && mkdir ${opt_output} for f in `find . -name '*,v' -print`; do out=`echo ${f} | sed -e 's:^\(.*\)/RCS/\(.*\),v$:\1/\2:'` if [ ! -d "${opt_output}/`dirname ${out}`" ]; then mkdir "${opt_output}/`dirname ${out}`" fi co -kv -r${name} -p ${f} >${opt_output}/${out} chmod -w ${opt_output}/${out} done else if [ ${opt_delete} != 0 ]; then # Delete tag $name rcs_opt="-n${name}" else # Create tag $name rcs_opt="-n${name}:" fi for f in `find . -name '*,v' -print`; do rcs ${rcs_opt} ${f} done fi