[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New CVSROOT, old sandbox.
From: |
Greg A. Woods |
Subject: |
Re: New CVSROOT, old sandbox. |
Date: |
Thu, 6 Sep 2001 21:44:03 -0400 (EDT) |
[ On Thursday, September 6, 2001 at 20:06:15 (-0400), Eric Siegerman wrote: ]
> Subject: Re: New CVSROOT, old sandbox.
>
> On Thu, Sep 06, 2001 at 03:21:01PM -0700, Jimmy Rimmer wrote:
> > What's the easiest way to change the CVS/Root entries? The directory
> > structure is mind-bogglingly huge.
>
> for f in `find . -type f -print | grep 'CVS/Root$'`; do
> echo newserver:/newroot >$f
> done
Yes I've done that myself several times.....
However I found the following nifty little shell script in my anti-perl
desire to find a usable pre-canned non-perl solution that covered many
of the corner cases that a hand-typed find/xargs command wouldn't. I
think it's been tested, but I won't warrantee it.... (and I don't know
who "gotoh" is, but I presume that's the author's login ID):
#!/bin/sh
#
# cvschroot - change CVS/Root and CVS/Repository
#
# usage: cvschroot [-d work_directory] new_cvsroot [new_module]
#
# examples:
# % setenv CVSROOT :pserver:address@hidden:/cvs/cvsroot
#
# % cd /usr/pkgsrc/shells/tcsh
# % cvschroot $CVSROOT
#
# or
#
# % cvschroot -d /usr/pkgsrc $CVSROOT pkgsrc
#
# $Id: cvschroot,v 1.1.1.1 2001/03/14 06:35:39 gotoh Exp $
# set workspace
if [ "$1" = "-d" ]; then
workdir=`echo $2 | sed -e 's@/$@@'`
if [ ! -d "$workdir" ]; then
echo "$0: $workdir: not found directory" >&2
exit 1
fi
shift; shift
else
workdir=.
fi
# check options
if [ $# -lt 1 ]; then
echo "usage: cvschroot [-d work_directory] new_cvsroot [new_module]" >&2
exit 1
fi
# set newcvsroot and newmodule
newcvsroot=$1
[ -n "$2" ] && newmodule=`echo $2 | sed -e 's@/$@@'`
find $workdir \( -name Root -o -name Repository \) -print | while read f; do
case $f in
*/CVS/Root)
echo changing $f
echo $newcvsroot > $f
;;
*/CVS/Repository)
[ -n "$newmodule" ] || continue
subdir=`echo $f | sed "address@hidden(.*\)/CVS/address@hidden@"`
echo changing $f
echo ${newmodule}${subdir} > $f
;;
esac
done
exit 0
--
Greg A. Woods
+1 416 218-0098 VE3TCP <address@hidden> <address@hidden>
Planix, Inc. <address@hidden>; Secrets of the Weird <address@hidden>