#!/usr/bin/perl -w # # VSS to Perforce converter, phase IV: niceties after the fact # # Copyright 1998 Perforce Software. All rights reserved. # Written by James Strickland, April 1998 # # This script sorts the mapping output by phase III to be keyed by archive, # then revision number. # # $Id: //guest/perforce_software/vsstop4/main/sortmap.pl#1 $ # 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(/#/,$_,4) ]; } # 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 Visual SourceSafe file name. # For each file all VSS revisions are listed with the associated Perforce # change number and filename.\n"; foreach $checkin (@checkins) { my ($revision,$change_number,$depot_file,$archive) = @$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[3]; $archiveb = $$b[3]; if($archivea ne $archiveb) { return $archivea cmp $archiveb; } return $$a[0] <=> $$b[0]; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 16012 | Robert Cowham | Rename/move project to conform to new Workshop naming structure. | ||
//guest/perforce_software/utils/vsstop4/main/sortmap.pl | |||||
#3 | 3639 | Robert Cowham |
Changed filetype and inserted ID string. Fixed typo. |
||
#2 | 2165 | Robert Cowham | Merged in changes from Guest branch | ||
#1 | 2160 | Robert Cowham | Main version from .zip file from http://www.perforce.com/perforce/loadsupp.html#conv page |