eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # THE PRECEEDING STUFF EXECS perl via $PATH # -*-Fundamental-*- # $Id: //guest/richard_geiger/utils/cvs2p4/bin/genmetadata#14 $ # # Richard Geiger # require 5.000; sub dirname { local($dir) = @_; $dir =~ s%^$%.%; $dir = "$dir/"; if ($dir =~ m%^/[^/]*//*$%) { return "/"; } if ($dir =~ m%^.*[^/]//*[^/][^/]*//*$%) { $dir =~ s%^(.*[^/])//*[^/][^/]*//*$%$1%; { return $dir; } } return "."; } use Carp; # ...or flounder. (This will fail unless 'perl' is a perl5!) $| = 1; ($Myname = $0) =~ s%^.*/%%; $Mydir = &dirname($0); $Here = `/bin/pwd`; chop $Here; if ($Mydir ne ".") { chdir "$Mydir" || die "$Myname: can't chdir \"$Mydir\": $!"; } chdir ".." || die "$Myname: can't chdir \"..\": $!"; $Mydir = `/bin/pwd`; chop $Mydir; chdir $Here || die "$Myname: can't chdir \"$Here\": $!"; require "$Mydir/lib/util.pl"; $Usage = <<LIT; $Myname: usage: $Myname LIT sub usage { print STDERR $Usage; exit 1; } sub help { print STDERR <<LIT; $Usage $Myname is not done yet. Be patient. LIT exit 1; } sub mklabel { my ($label, @Revs) = @_; print "make label: $label\n"; if (! open(P4, "$P4 label -o $label | $P4 -s label -i |")) { print STDERR "$Myname: can't open \"$P4 label -o $label | $P4 label -i |\": $!.\n"; exit 1; } $ok = 1; while (<P4>) { if (/^error: /) { print; $ok = 0; } } if (! $ok) { print STDERR "$Myname: \"$P4 label -o $label | $P4 -s label -i\" failed.\n"; exit 1; } if (! open(LABELSYNC, ">$Convdir/labelsync")) { print STDERR "$Myname: can't open \"$Convdir/labelsync\": $!.\n"; exit 1; } foreach my $rev (@Revs) { print LABELSYNC "$rev\n"; } close LABELSYNC; if (! open(P4, "$P4 -s -x - labelsync -l $label < $Convdir/labelsync |")) { print STDERR "$Myname: can't open \"$P4 labelsync -l $label < $Convdir/revs.$label |\": $!.\n"; } $ok = 1; while (<P4>) { print; if (/^error: /) { $ok = 0; } } if (! $ok) { print STDERR "$Myname: \"$P4 -s -x - labelsync -l $label < $Convdir/labelsync\" failed.\n"; exit 1; } unlink "$Convdir/labelsync"; } # option switch variables get defaults here... $Convdir = ""; $Boolopt = 0; $Valopt = 0; while ($#ARGV >= 0) { if ($ARGV[0] eq "-boolopt") { $Boolopt = 1; shift; next; } elsif ($ARGV[0] eq "-valopt") { shift; if ($ARGV[0] < 0) { &usage; } $Valopt = $ARGV[0]; shift; next; } elsif ($ARGV[0] eq "-help") { &help; } elsif ($ARGV[0] =~ /^-/) { &usage; } if ($Args ne "") { $Args .= " "; } push(@Args, $ARGV[0]); shift; } if ($#Args ne 0) { &usage; } $Convdir = $Args[0]; $Metadata = "$Convdir/metadata"; $Labels = "$Convdir/labels"; $Rrevmap = "$Convdir/rrevmap"; require "$Convdir/config"; # Path the the p4 client command # if (! defined($P4)) { $P4 = "/usr/local/bin/p4"; } if (! -x ($P4)) { print "$Myname: No executable \"p4\" command at \"$P4\".\n"; exit 1; } $P4 = "$P4 -p $P4PORT -c $P4CLIENT -u $P4USER"; if (! dbmopen(RREVMAP, $Rrevmap, 0444)) { print "$Myname: can't dbmopen \"$Rrevmap\": $!\n"; exit 1; } if (! open(LABELS, "<$Labels")) { print "$Myname: can't open \">$Labels\": $!\n"; exit 1; } @Revs = (); while (<LABELS>) { if (/^([^\s]+)/) { if ($#Revs >= 0) { &mklabel($label, @Revs); } $label = $1; @Revs = (); } elsif (/^ (.*)/) { if ($rev = $RREVMAP{$1}) { push (@Revs, $rev); } } } if ($#Revs >= 0) { &mklabel($label, @Revs); } close LABELS; dbmclose RREVMAP; exit 0;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#14 | 8160 | michael |
Archive obsolete CVS to Perforce converter. See the Perforce KB and website for an updated CVS to Perforce converter. |
||
#13 | 7274 | Richard Geiger | Integrate dev changes to become 3.1 | ||
#12 | 5649 | Richard Geiger | Integrate 3.0b5, b6 changes... | ||
#11 | 5619 | Richard Geiger | Changes for 3.0b4 | ||
#10 | 5601 | Richard Geiger | Integrate 3.0 changes, preparing to publish. | ||
#9 | 5145 | Richard Geiger | Publish 2.5.5 | ||
#8 | 4354 | Richard Geiger | Integrate 2.4 changes. | ||
#7 | 3711 | Richard Geiger | release 2.3.7 | ||
#6 | 2063 | rmg | Publish 2.3.2 | ||
#5 | 1989 | Richard Geiger | Public 2.3.1 | ||
#4 | 1786 | rmg | Publish 2.0 | ||
#3 | 1410 | rmg | Publish 1.3.2 | ||
#2 | 1205 | Richard Geiger | Publish 1.3.1 | ||
#1 | 1187 | Richard Geiger |
1.3. Mainly, support for labels! |
||
//guest/richard_geiger/utils/cvs2p4/bin/dolabels | |||||
#1 | 1185 | Richard Geiger |
Changes for 1.3 (Labels!) |