info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


From: root
Subject: (no subject)
Date: Mon, 13 Aug 2001 05:13:12 -0400

>From address@hidden  Fri Feb  9 17:55:43 2001
>Return-Path: <address@hidden>
Received: from fencepost.gnu.org (address@hidden [199.232.76.164])
        by gateway.camelot.jp (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id 
RAA02996
        for <address@hidden>; Fri, 9 Feb 2001 17:55:37 +0900
Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org)
        by fencepost.gnu.org with esmtp (Exim 3.16 #1 (Debian))
        id 14R9Gl-000846-00; Fri, 09 Feb 2001 03:51:07 -0500
Received: from gatekeeper220.eurotherm.co.uk ([193.129.71.220] 
helo=schnapps.eurotherm.co.uk)
        by fencepost.gnu.org with esmtp (Exim 3.16 #1 (Debian))
        id 14R9F4-00081O-00
        for <address@hidden>; Fri, 09 Feb 2001 03:49:22 -0500
Received: from merlot.controls.eurotherm.co.uk (IDENT:address@hidden 
[149.121.128.168])
        by schnapps.eurotherm.co.uk (8.9.3/8.9.3) with ESMTP id IAA26182;
        Fri, 9 Feb 2001 08:49:04 GMT
Received: from MOA (moa.controls.eurotherm.co.uk [149.121.128.117])
        by merlot.controls.eurotherm.co.uk (8.8.7/8.8.7) with ESMTP id IAA23047;
        Fri, 9 Feb 2001 08:48:54 GMT
To: "Deaver, Carl" <address@hidden>
Cc: address@hidden
Subject: Re: Transferring the CVS to another hosts
References: <address@hidden>
From: Martin Tomes <address@hidden>
In-Reply-To: <address@hidden>
Message-ID: <address@hidden>
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=_webhead-7125-997693983-0001-2"
Sender: address@hidden
Errors-To: address@hidden
X-BeenThere: address@hidden
X-Mailman-Version: 2.0
Precedence: bulk
List-Help: <mailto:address@hidden>
List-Post: <mailto:address@hidden>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/info-cvs>,
        <mailto:address@hidden>
List-Id: Announcements and discussions for the CVS version control system 
<info-cvs.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/info-cvs>,
        <mailto:address@hidden>
List-Archive: <http://mail.gnu.org/pipermail/info-cvs/>
Date: 09 Feb 2001 08:48:54 +0000
Status: O
Content-Length: 5524
Lines: 29

This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_webhead-7125-997693983-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

>>>>> "Carl" == Deaver, Carl <address@hidden> writes:

    Carl> Inside
    Carl> that CVS folder are 4 files. 2 of which are ROOT and Repository.
    Carl> Inside each one of these ROOT files contains information as to who
    Carl> checked out these modules, which includes the server name. for
    Carl> example:
    Carl> :pserver:address@hidden:/data/sndev003/02/home/cvsop/qc

Find attached a perl program for changing CVS server.

It was written to change from a machine called merlot.controls.eurotherm.co.uk
to cvs.controls.eurotherm.co.uk.  I also changed the path on the repository
from /usr/local/repository to /cvs/controls.  Some of the checkouts had full
path names in the Repository file which started with /usr/local/repository,
this script strips that off the path to make it relative to the one in Root.

You will have to change the names and paths, but variations of this have been
used to move repositories several times.  You *must* test it thoroughly and
back up your checkouts before running it.  Users either need Perl installed,
or if you are using windows you can buy the ActiveState PerlDev kit to turn it
into a .exe

-- 
Martin Tomes

address@hidden

--=_webhead-7125-997693983-0001-2
Content-Type: application/octet-stream
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=changeserver.pl
Content-Description: changeserver

#!perl
#line 14
#
# This program changes the server name in the CVS/Root files.
#
# Need the full path from the root of this drive for the Entering directory
# messages.
use strict;

my $rootd=qx{cd};
chop($rootd);
$rootd =~ s/[a-zA-Z]://;
$rootd =~ s/\\/\//g;
my @dir_stack;
my @rdir_stack;
sub pushd {
    my($d) = @_;
    my($cwd) = qx{cd};
    chop($cwd);
    push(@dir_stack, $cwd);
    # Want a relative one as well
    push(@rdir_stack, $d);
    # This is for emacs compilation mode so it knows which directory files are
    # in.
    my $i;
#    print "\nchserver: Entering directory `" . $rootd . "/";
    for ($i=0; $i<=($#rdir_stack-1); $i++) {
        # Ignore path name . as it is superfluous.
#       print $rdir_stack[$i] . "/" if ($rdir_stack[$i] ne ".");
    }
#    print $rdir_stack[$#dir_stack] . "'\n";
    chdir($d) || die "Could not chdir($d)\n";
}

sub popd {
    my $d = pop(@dir_stack);
    pop(@rdir_stack);
    chdir($d) || die "Could not chdir($d)\n";
}

sub dodir {
    my ($dir, $level) = @_;
    local(*D);
    if (!opendir(D, $dir)) {
        print "Failed to open $dir\n";
        return
    }
    my(@allfiles)=sort grep(!/^\.\.?$/,readdir(D));
    closedir(D);
    foreach my $file (@allfiles) {
        if (-d "$dir/$file") {
            if (lc($file) eq "cvs") {
                print "$dir";
                local(*IN);
                local(*OUT);
                &pushd("$dir/$file");

                if (!-f "Root") {
                    print "WARNING: Didn't find $dir/$file/Root\n";
                } else {
                    my $haschanged = 0;
                    if (open(IN, "<Root")) {
                        if (open(OUT, ">tmp")) {
                            while (<IN>) {
                              if (/merlot/) {
                                s+/usr/local/repository+/cvs/controls+;
                                s+/usr/local/us_repository+/cvs/usa+;
                                s/address@hidden/address@hidden/;
                                $haschanged = 1;
                              }
                              print OUT;
                            }
                            close(OUT);
                        }
                        close(IN);
                        if ($haschanged) {
                          unlink "Root";
                          rename "tmp", "Root";
                          print " (Root)";
                        } else {
                          unlink "tmp";
                        }
                    }
                }

                # Make sure that the path in this file is relative to the
                # repository root.
                if (!-f "Repository") {
                    print "WARNING: Didn't find $dir/$file/Repository\n";
                } else {
                    my $haschanged = 0;
                    if (open(IN, "<Repository")) {
                        if (open(OUT, ">tmp")) {
                            while (<IN>) {
                              if (/^\/usr\/local\/repository\//) {
                                s+++;
                                $haschanged = 1;
                              }
                              if (/^\/usr\/local\/us_repository\//) {
                                s+++;
                                $haschanged = 1;
                              }
                              print OUT;
                            }
                            close(OUT);
                        }
                        close(IN);
                        if ($haschanged) {
                          unlink "Repository";
                          rename "tmp", "Repository";
                          print " (Repository)";
                        } else {
                          unlink "tmp";
                        }
                    }
                }

                &popd;
                print "\n";
            } else {
                &dodir("$dir/$file", $level + 1);
            }
        }
    }
}

&dodir(".", 1);

--=_webhead-7125-997693983-0001-2--



reply via email to

[Prev in Thread] Current Thread [Next in Thread]