Changing CVS roots in existing checkouts

SO I got a chunk of CVS and the server has been moved. See this for the Unix version.

I am on windows, with no Cygwin (in this machine).


use strict;
use Cwd;
use File::Find;
use File::Copy;
use File::Basename;

my $NEW_CVSROOT = ':pserver:xxxxx@xxxxx.xxxx:/cvs/xxxxxx';
my $RootFolder = cwd();
&find( \&Filter_OverwriteRoot, $RootFolder );
warn "$0 Process complete. Terminating...\n";
exit(0);

#########################################

sub Filter_OverwriteRoot # ()
{
my $fileSpec = $File::Find::name;
my $fileName = $_;

# if a file...
if ( -f $fileSpec )
{
# Root is done
if ( $fileName =~ /^Root$/i )
{
print "update $File::Find::dir $fileName \n";
open (FILE, ">$fileName") || die "Can't open $fileName: $!\n";
print FILE $NEW_CVSROOT . "\n";
close(FILE);
}

}
}

Run this in the root folder for the checked out code. Seems to work…

MAKE SURE YOU ONLY HAVE ONE ROOT LINE PER CVS/Root file! The other solution replaces them all. Mine doesn’t.

Leave a Reply