#!/usr/bin/perl -w # # VSS to Perforce converter, phase V: verify Perforce depot # # Copyright 1998 Perforce Software. All rights reserved. # Written by James Strickland, April 1998 # # This script uses the metadata produced by earlier phases to direct a loop # which extracts VSS revisions and verifies that the Perforce version # stores the same information. require 5.0; use strict; use integer; use lib '.'; use convert; use Change; $ENV{P4CLIENT} = 'vss' unless defined($ENV{P4CLIENT}); $ENV{P4USER} = 'vss' unless defined($ENV{P4USER}) or defined($ENV{USER}) or defined($ENV{USERNAME}); open(LOG,">>logfile") or die "can't open logfile: $!"; my $last_change = convert::run("p4 changes -m 1"); die "Didn't recognize the output of p4 changes: $last_change" unless($last_change =~ /^Change\s+(\d+)/); $last_change=$1; print "There are $last_change changes in the depot.\n"; # open all our input files open(MAPPING, "$convert::metadata_dir/mapping.ns") or die "can't open: $!"; # overwrite client files with revisions from VSS, then use p4 diff # to verify that the file is the same as the version in the depot my $failed=0; my $prev_change_number=1; while(<MAPPING>) { chomp; my ($revision,$change_number,$depot_file,$vss_file)=split(/#/,$_,4); my $client_file; my $fstat = convert::run("p4 fstat \"$depot_file\@$change_number\""); if( $fstat =~ /clientfile (.*)\n/im ) { $client_file = convert::forward_slash($1); } else { $failed=$change_number; print "WARNING!!! p4 fstat failed on change $failed\n"; print LOG "WARNING!!! p4 fstat failed on change $failed\n"; next; } if( $fstat =~ /headtype tempobj\n/im ) { next; # ignore tempobj files - they will not match, by design } my $client_dir = $client_file; $client_dir =~ s@/[^/]*$@@; convert::get_vss_file($vss_file,$revision,$client_dir,$client_file); if(convert::run("p4 diff -f -se \"$depot_file\@$change_number\"")) { $failed=$change_number; print "WARNING!!! $depot_file\@$change_number differs from VSS file $vss_file revision $revision\n"; print LOG "WARNING!!! $depot_file\@$change_number differs from VSS file $vss_file revision $revision\n"; print convert::run("p4 diff -f \"$depot_file\@$change_number\""); print "\n"; next; } if($change_number!=$prev_change_number) { print "Change $prev_change_number ok.\r" unless($failed == $prev_change_number); $prev_change_number=$change_number; } } if($failed) { print "VERIFY FAILED\n"; } else { print "Verify succeeded - all file revisions in Perforce match those in VSS.\n"; } close(LOG);
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 1513 | Peter Steiner |
- writing to the logfile in verify.pl didn't work - convert.pm: get_vss_file failed sometimes (when there was a file in the working directory with the same name as one in the VSS archive) - the timestamp of a label is now set from the VSS label timestamp - files can be added using perforce typemaps for determining the file type (though this is disabled because it is likely to break verify.pl when the revisions are compared using different keyword expansion methods...). See convert::typemap_regexp - new option lowercase_extensions (similar to lowercase_filenames) - option convert::perform_verify (no more need to press a key during nightly conversion tests) - label name transformations to cope better with special character restrictions. You probably want to adjust for your own purposes; see readhist.pl line 169ff. - output of convert.pl adorned with timestamps - changes for Swiss time format are prepared (in the comments of readhist.pl), though this probably should be done with specifying a regexp in the config file - various fixes when using german umlauts, especially in Windows login names propagated to VSS, in labels and comments |
||
#2 | 1511 | Peter Steiner |
merged the changes from the "official" perforce version from 2001-12-21, available from ftp://ftp.perforce.com/pub/perforce/r01.1/tools/convert/vss/vsstop4.zip |
||
#1 | 1510 | Peter Steiner | integrated from Roberts vsstop4 branch | ||
//guest/robert_cowham/perforce/utils/vsstop4/verify.pl | |||||
#1 | 237 | Robert Cowham |
Improved version of vsstop4. Makes life easier if importing into a depot which already contains stuff you want to keep. Also handles other people updating the depot at the same time. See changes labelled RHGC, and new items in config file. |