[p4] Convert CVS to P4 using rcstoperf.sh

Yee, Owen oyee at vignette.com
Wed Oct 11 07:54:25 PDT 2000


Hi all,

I am a P4 newbie, I am trying to convert our CVS files over to P4 using the
rcstoperf.sh.  Is there a newer rcstoperf.sh script then the one on the
perforce site? Any help is MUCH appreciated.

Thanks 
- OwenYee

P.S. Here is the huge awk statement thats causing me syntax errors, (this is
plain sh script.)

   echo 'building p4 metadata checkpoint file...' 1>&2

    ( cat "$CHANGES"; echo "@---@"; sed 's:\(@//[^ @]*\) :\1!!!:g'
"$EXTRACT" ) |
    awk '

            $0 == "@---@" {
                print "@put@ @db.counters@ @change@", lastChange
                ++state
                next
            }

            state == 0 {

                seenChange[$1] = 0;
                lastChange = $1;
                changeTable[ $2$3$4 ] = $1;
                next
            }

            state == 1 && $1 == "@rev@" {

                change = changeTable[ $6$9$10 ];

                print "@put@ @db.rev@", $2, $3, 0, $4, $5, change, $6, $7,
$8, 0
                print "@put@ @db.revcx@", change, $2, $3, $5

                next;
            }

            state == 1 && $1 == "@integ@" {

                print "@put@ @db.integ@", $2, $3, $4, $5, $6,$7, $8, $9,$10
                next;
            }

            state == 1 && $1 == "@label@" {

                if( $6 > labelDate[ $2 ] )
                    labelDate[ $2 ] = $6;

                print "@put@", "@db.have@", $3, $4, $5

                next
            }

            state == 1 && $1 == "@change@" {

                change = changeTable[ $2$3$4 ]
                if( seenChange[ change ] )
                {
                    if( $5 == "@" && NF == 5 || $NF !~ /@[[:space:]]*$/ )
                        skipping = 1;

                    next;
                }

                seenChange[ change ] = 1;

                d = ""; for( i = 5; $i != ""; i++ ) d = d $i " ";
                subd = substr( d, 1, 31 );
                gsub( /@/, "", subd );
                subd = "@"subd"@"

                print "@put@ @db.change@", change, change, \
                        "@cvs@", $4, $2, 1, subd
                print "@put@ @db.desc@", change, d

                # Turn on printing if this change description spans
                # more than one line.

                if( $5 == "@" && NF == 5 || $NF !~ /@[[:space:]]*$/ )
                    printing = 1;

                next;
            }

            state == 1 && skipping == 1 {
                if( $NF ~ /@[[:space:]]*$/ )
                    skipping = 0;

                next;
            }

            state == 1 && printing == 1 {
                print

                if( $NF ~ /@[[:space:]]*$/ )
                    printing = 0;

                next;
            }
            END {
         for( l in labelDate )
                    print "@put@ @db.domain@", l, 108, "@@ @@ @cvs@", \
                            labelDate[ l ], 0, "@Imported from CVS.@"
            }
    ' | sed 's/!!!/ /g' > "$META"
    ;;




More information about the perforce-user mailing list