Hi Jesper,

Well, well, well!  Someone else is trying what we tried awhile back!  You're
running into the fact that MKS has introduced a little extension to the RCS
file format (if I remember correctly, it came in the form of a new tag
called "ext").  Don't know how standard it is, but if you remove that
section from the RCS file you should be good to go.  I wrote a little perl
program to do this which I've posted below.  I am NOT a perl expert so the
usual disclaimers apply.  The other problem you'll run into is that MKS did
not keep the convention of the ',v' at the end of the file and I have
another script (this ones a shell script) that will take care of this for
you.  Also, the RCS directory was renamed to rcs and the previous script was
modified from its original format to take this into account (see the credits
for the original authors).  Basically, here is what we did (BTW, these
directions include a move to a Linux server.  If you're not doing that,
you'll have to do something else for the rcs_to_cvs script):

1. Tar up the directory hierarchy.  I used Cygwin's tar to do this.
2. Move the tar file to the Linux machine and un-tar it.
3. Run the si_to_rcs.pl script in the top level dir of your source.  Check
it for any modifications you may have (I don't think this one needs to be
modified, assuming the perl is all ok ;) )
4. Run the cvs_to_rcs shell script.  You'll need to modify this one,
particularly the RCS_DIRECTORY and TMP_RCS_DIR variables.
5. Copy the hierarchy over to its new location and finish the stuff that CVS
needs!

Here are the scripts:

si_to_rcs.pl:

#!/usr/bin/perl

#
# Need to recurse into every directory in the repository's
# hierarchy and take out, from each file, the lines that
# look like the following:
# ext
# @project N:/EaDev/eadev.pj;
# @
#

convert_dir(".");

#
# converts all the files in the directory name passed to it
# from MKS Source integrity archives to vanilla RCS archives
#

sub convert_dir {

    # First, change the working dir to the dir
    # passed in to us.
    #
    chdir( $_[0] );
    print "cd $_[0]\n";

    foreach $file (<*>){
        if( -d $file ){
            convert_dir( $file );
            chdir( ".." );
        } else {
            convert_file( $file );
        }
    }

}

#
# converts the file name passed to it from a MKS Source
# Integrity archive to a vanilla RCS archive.  Renames
# the original archive file to [filename]~bak
#

sub convert_file {

# Loop over all the lines in the file
# and 

    @ARGV = $_[0];
    $^I = "~bak";

    while(<>) {

        # We're looking for the following three lines
        # ext
        # @project xxxxxxxx
        # @

        unless ( /^ext$/ ... /^\@$/ ) {
            print;
        }
    }
}

rcs_to_cvs:

#!/bin/ksh

#############################################################
# Program to Migrate the existing source code in RCS to CVS 
#
# Needs the korn shell RPM package  pdksh*.rpm from Linux 
# contrib cdrom
#############################################################

#############################################################
# Changed RCS to rcs.  Source Integrity names the archive
# directory rcs instead of RCS -- CLC 9 Feb 2000
#############################################################

# Enter your current RCS file location here.
RCS_DIRECTORY=/home/cching/tmp/eadev

# Temporary directory to hold the files
TMP_RCS_DIR=$HOME/tmp/cvsroot/eadev

mkdir $TMP_RCS_DIR

# Copy the tree having RCS directory into temporary directory
cd $RCS_DIRECTORY
tar cvf -  ` find . -name rcs -print ` | ( cd $TMP_RCS_DIR; tar -xvf - )

cd $TMP_RCS_DIR

for ii in `find . -type f -print` ; 
do 
        # $ii will have like /home/foo/RCS/sample.c,v
        echo $ii

        # Get the dir name like /home/foo/RCS from ii
        kk=`dirname $ii`
        # echo $kk

        # Drop off RCS from kk - like /home/foo
        jj=`dirname $kk`
        #       echo $jj

        # Move file from RCS to upper leve like
        # mv /home/foo/RCS/sample.c,v  /home/foo
        mv $ii $jj
done

# Remove the empty directory RCS like -
# rmdir /home/foo/RCS
cd $TMP_RCS_DIR
find  . -type d -name rcs -exec rmdir {} \;

# The resultant directory is $TMP_RCS_DIR (which is $HOME/tmp_rcs_directory)
# Move the directory tmp_rcs_directory to $CVSROOT/some_project_name
# Now the RCS is migrated to CVS as 'some_project_name' .

Please, please, please work on a copy of your source code as I won't
guarantee the correctness or completeness of either of these scripts.  They
did seem to work well for me thoug!  Good luck and e-mail me if you have any
questions!

Craig L. Ching
--------------------------------------------
Craig L. Ching
Chief Product Architect
IBM Certified Specialist, MQSeries
IBM Certified Developer, MQSeries
MQSoftware, Inc.
(612) 546-9080
www.mqsoftware.com
--------------------------------------------

-----Original Message-----
From: Jesper Pedersen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 11, 2000 9:24 AM
To: '[EMAIL PROTECTED]'
Subject: MKS/SI and CVS


Hi.

I'm about to move a RCS repository made
by MKS Source Integrity 7.3e (Windows version) 
to CVS.

Does anybody have experience in doing so ?

I've made a small test based on the information
located on page 28 in the CVS manual, but doesn't
seem to be enough. I get alot of:

  unexpected end of file reading ..
  duplicated key 'text' in RCS file ...

So close, but no cigar :(

Any help would be great !

Cheers,

 Jesper Pedersen

P.S. I'm not on the mailing-list.

Reply via email to