#!/usr/bin/perl -w # # PVCS to Perforce converter, phase IV: niceties after the fact # # Copyright 1997 Perforce Software. All rights reserved. # Written by James Strickland, July 1997 # # This script sorts the mapping output by phase III to be keyed by archive, # then revision number. require 5.0; use strict; use integer; use lib '.'; use convert; open(MAPPING, "<$convert::metadata_dir/mapping.ns") or die "can't open for read: $!"; open(NEWMAPPING, ">$convert::metadata_dir/mapping") or die "can't open for write: $!"; my (@checkins,$checkin); # read 'em in while(<MAPPING>) { chomp; push @checkins,[ split(/#/) ]; } # sort 'em @checkins = sort by_archive_then_revision @checkins; # write 'em out my $last_archive=""; my $archive_count=0; print NEWMAPPING "# This file is sorted by archive name. # For each archive all PVCS revisions are listed with the associated Perforce # change number and filename.\n"; foreach $checkin (@checkins) { my ($archive,$revision,$change_number,$depot_file) = @$checkin; if($archive ne $last_archive) { print NEWMAPPING "\n\"$archive\"\n"; $last_archive=$archive; $archive_count++; } printf NEWMAPPING "%16s %4d \"%s\"\n",$revision,$change_number,$depot_file; } my $summary = "\n" . scalar(@checkins) . " revisions in $archive_count archives.\n"; print NEWMAPPING $summary; print $summary; sub by_archive_then_revision { my ($archivea,$archiveb); $archivea = $$a[0]; $archiveb = $$b[0]; if($archivea ne $archiveb) { return $archivea cmp $archiveb; } my (@reva,@revb); @reva = split(/\./,$$a[1]); @revb = split(/\./,$$b[1]); if($#reva != $#revb) { return $#reva <=> $#revb; } my $i; for($i=0;$i<=$#reva;$i++) { if($reva[$i] != $revb[$i]) { return $reva[$i] <=> $revb[$i]; } } return 0; # they're the same (this shouldn't actually happen..) }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 5093 | Hari Krishna Dara |
Populating perforce branch. I will be adding p4admin files to it. |
||
//guest/perforce_software/utils/pvcstop4/main/sortmap.pl | |||||
#1 | 4664 | Robert Cowham | Branch into permanent location. | ||
//guest/robert_cowham/perforce/utils/pvcstop4/main/sortmap.pl | |||||
#1 | 4647 | Robert Cowham |
Rename //guest/robert_cowham/perforce/utils/pvcstop4/... To //guest/robert_cowham/perforce/utils/pvcstop4/main/... |
||
//guest/robert_cowham/perforce/utils/pvcstop4/sortmap.pl | |||||
#1 | 2289 | Robert Cowham | Initial version from Perforce web page |