info-cvs
[Top][All Lists]
Advanced

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

pvcs to cvs and magic branches


From: Jim Gallagher
Subject: pvcs to cvs and magic branches
Date: 12 Jul 2001 09:00:38 PDT

I'm in the process of converting a project from pvcs to cvs. I found the 
pvcs2cvs.pl script, which basically extracts each rev from pvcs and then
checks it into rcs. I'm tweaking the script to handle some cases the original
author didn't expect, and I'm very curious about a section of 
the script that deals with converting pvcs revs to rcs revs (the subroutine is
at the end of this message.) 

What is the reasoning for multiplying all branch revs by 2? RCS doesn't 
require this. I thought that cvs could read rcs archives without a 
problem.

Thanks,

Jim

sub pvcs_to_rcs_rev_number
        {
        my($input, $num_fields, @rev_string, $return_rev_num, $i);

        $input = $_[0];
        $_ = $input;
        $num_fields = split /\./;
        @rev_string = @_;
        # @rev_string[$num_fields-1] += 1;

        for( $i = 1; $i < $num_fields; $i += 1 )
                {
                if ( $i % 2 )
                        {
                        # DRP: 10/1
                        # RCS does not allow revision zero
                        $rev_string[ $i ] += 1;
                        }
                elsif ( $i )
                        {
                        # DRP: 10/1
                        # Branches must have even references for compatibility
                        # with CVS's magic branch numbers.
                        # (Indexes 2, 4, 6...)
                        $rev_string[ $i ] *= 2;
                        }
                }

        # If this is a branch revision # (PVCS: a.b.c.*) then we want the CVS
        # revision # instead.  It's okay to do this conversion here since we
        # never commit to branches.  We'll only get a PVCS revision # in that
        # form when looking through the revision labels.
        if ($input =~ /\*$/)
                {
                pop @rev_string;
                push @rev_string, splice (@rev_string, -1, 1, "0");
                }

        $return_rev_num = join ".", @rev_string;
        return $return_rev_num;
        }


____________________________________________________________________
Get free email and a permanent address at http://www.amexmail.com/?A=1



reply via email to

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