Subject: Re: CVS Tree
To: Rick Byers <rickb@iaw.on.ca>
From: Curt Sampson <cjs@portal.ca>
List: current-users
Date: 03/27/1997 23:52:48
On Thu, 27 Mar 1997, Rick Byers wrote:
> Is there any way to access (read) the CVS tree (like anon-CVS)?
Not yet. But it's being worked on.
> It would also be a lot easier to maintain local changes if
> I could use CVS....
No, being able to read our repository doesn't help you at all with
local changes, since you need to keep your own private CVS tree,
and import into that, to be able to do this.
> How do others maintain local changes? I guess I
> could use CVS import on newly supped sources, but going CVS->sup->CVS
> seems sort of silly as well..
No, that's the correct way to do it. I have CVS access, and I still
have to do essentially the same thing: update my checkout of the
NetBSD CVS repoisitory, import it into my personal repository, and
merge. I've appended a copy of the Q&D script I use to do this; it
should work almost as-is for you; you'll just have to replace the
initial CVS checkout with a sup update.
If anyone wants to clean this up, make it more general, write a
manpage, or whatever, and send changes back to me, I could make a
package available for ftp download.
cjs
Curt Sampson cjs@portal.ca Info at http://www.portal.ca/
Internet Portal Services, Inc.
Vancouver, BC (604) 257-9400 De gustibus, aut bene aut nihil.
# Procedures for Imports
# $Id$
# configuration
#
cvsroot=/usr2/CVSRoot
repository=netbsd
branch=NetBSD
# version is set below
confdir=/usr1/NetBSD
logdir=/usr1/NetBSD/logs/
import_tree=/usr1/NetBSD/checkouts/current
local_tree=/usr1/NetBSD/checkouts/cjs
#import_tree=/home/cjs/tmp/4/current
#local_tree=/home/cjs/tmp/4/netbsd
dirs="doc othersrc src"
# find version
versionfile=$import_tree/src/sys/conf/newvers.sh
version=`sed -n -e 's/^osr="\(.*\)"$/\1/p' $versionfile | sed -e 's/\./_/g`
# remove ./ from line beginnning, and all CVS dirs/files
sedstrip='s#^./##;\|^CVS$|d;\|/CVS$|d;\|^CVS/|d;\|/CVS/|d'
# get currrent date, etc.
#
startdate=`date`
date=$(date +%Y%m%d)
tag=$branch-$version-$date
# log under subdirectory by date
logdir=$logdir/$date
mkdir $logdir
echo "NetBSD import script importing $tag."
# update our source tree
#
echo; echo "Updating source tree:"
cd $import_tree
for dir in $dirs; do
if ! test -d $dir ; then
echo "Can't cd to $dir! Aborting."
exit 1
else
cd $dir
cvs -q update -dP -A | tee -a $logdir/update.$dir
if test $? -ne 0 ; then
echo "Error $? occured updating $import_tree/$dir; aborting."
exit $?;
fi
cd ..
fi
done
# update our local tree
echo; echo "Updating and tagging local tree:"
cd $local_tree
if ! cvs -q update -dP -A; then
echo "Error occured; aborting."
exit $?;
fi
# confirm local tree has no uncommited changes
#if [ -n "`cvs -q update -dP -A | grep -v '^? '`" ]; then
# echo "Error: checkout of local tree has uncommitted changes";
# exit 2;
#fi
echo cvs -q rtag pre-$tag $repository
if ! cvs -q rtag pre-$tag $repository; then
echo "Error occured; aborting."
exit $?;
fi
# find files to delete
#
echo; echo "Finding files to delete:"
cd $import_tree
find . -print | sed -e $sedstrip | sort >$logdir/filelist.import
cd $local_tree
# convert Keepfiles to a sed script
egrep -v '^#|^[ ]*$' Keepfiles |\
sed -e 's/^/\\|^/' -e 's/$/$|d/' >/tmp/Import.$$
find . -print | sed -e $sedstrip -f /tmp/Import.$$ |\
sort >$logdir/filelist.local
rm /tmp/Import.$$
comm -13 $logdir/filelist.import $logdir/filelist.local \
>$logdir/delete
if [ -s $logdir/delete ]; then
echo; echo "Deleting files:"
for f in `cat $logdir/delete`; do
echo $f
rm $f
cvs -q rm $f
done
cvs -q commit -m "Pre-import deletions for $tag."
else
echo "No files to delete."
fi
# do the import
#
echo; echo "Importing new source tree:"
cd $import_tree
cvs -q -d $cvsroot import \
-I ! -I CVS \
-m "$tag import." \
$repository $branch $tag \
>$logdir/import
sed -n -e '/^C /p;/^$/,$p' $logdir/import
echo; echo "Updating and merging local tree:"
cd $local_tree; cd ..
echo cvs -q co -d `basename $local_tree` -P "-j$branch:$startdate" -j$branch $repository
cvs -q co -P -d `basename $local_tree` \
"-j$branch:$startdate" -j$branch $repository 2>&1 |\
tee $logdir/update
echo; echo "Remember to commit this merge!"