#!/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::p4run(" 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::p4run(" 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::p4run(" 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::p4run(" 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 | |
---|---|---|---|---|---|
#1 | 1798 | Dave Hildebrandt | branch from //guest/robert_cowham | ||
//guest/robert_cowham/perforce/utils/vsstop4/verify.pl | |||||
#3 | 1695 | Robert Cowham | Integrated Peter's changes in - note not fully tested... | ||
#2 | 1691 | Robert Cowham |
Latest changes, e.g. - allow restarts (from date and time) - add client name to config options |
||
#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. |