#!/bin/sh # $Id: cvsimport_killnew,v 1.5 2003/01/16 01:27:55 cgd Exp $ # Script to kill revision 1.1 in files newly imported by CVS. # See http://www.demetriou.com/~cgd/cvs for details. # # Written by Chris G. Demetriou . Public domain. fatal() { echo '***' $0: ERROR: $1 1>&2 exit 1 } usage() { echo usage: $0 logfilename 1>&2 fatal usage exit 1 } if [ -z "${CVSROOT}" ]; then fatal "CVSROOT is unset" fi logfile=$1 if [ -z "$logfile" ]; then usage fi if [ ! -f "$logfile" ]; then fatal "$logfile does not exist" fi awk '/^N / { print $2 }' "$logfile" | ( set -e while read file; do repos_path=${CVSROOT}/${file},v repos_dir=`dirname ${repos_path}` repos_file=`basename ${repos_path}` if [ ! -f $repos_path ]; then echo "Warning: $repos_path does not exist." continue fi echo "Fixing $file..." ( # XXX error handling in this block is bogus... # a dir that won't (likely) be used. mkdir -p $repos_dir/CVS cd $repos_dir/CVS # reset default branch. rcs -b ../${repos_file} # check in new rev w/ same contents. co -l -M ../${repos_file} ci -r1.2 -d -sdead \ -m"revision 1.1 was added on the vendor branch; delete from trunk" \ ../${repos_file} ) rmdir $repos_dir/CVS || true echo "Moving $file to the attic..." mkdir -p ${repos_dir}/Attic mv ${repos_path} ${repos_dir}/Attic/${repos_file} done )