#!/usr/bin/perl -w
#This is a sample script. I have tested the script, but please test it
#thoroughly before using it on a production server.
#
use strict;
my $argc = @ARGV;
if($argc != 1) { die "Usage: deletedFilesFromBranch.pl <path>\n";}
my $p4 = "p4";
my $command = "filelog";
if(-f "final.txt") {
unlink "final.txt";
}
open(OUT,">>final.txt");
my @accessUpdate = `$p4 $command $ARGV[0]`;
my $path;
if($ARGV[0] =~ /^(\/\/.+\/)\.\.\./) {
$path = $1;
}
my $fileName = "";
my $inFile = 0;
#my $count = 0;
foreach (@accessUpdate) {
if(/^\/\/.+/) {
$fileName = $_;
}
if(/^$path/) {
$inFile = 1;
}
if(($inFile == 1) && (/^\.\.\.\s\#(\d+)\s(change)\s(\d+)\s(delete).*/)) {
print OUT "Rev.# $1 for Change# $3 was $4" . "d";
print OUT " FileName: $fileName";
$inFile = 0;
}
#$count++;
}
close(OUT);