#!/usr/bin/perl -w # -*- perl -*- use strict ; use HTML::Entities ; # # p4_filelog for Safari # Copyright (c) 1999 by Barrie Slaymaker, rbs@telerama.com # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # # Port of flv.cgi to safari. # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # P4 file log viewer # ################################################################# local *P ; # Get file argument my $file = $ARGV[ 0 ] ; my $listLabel = "Yes" ; $listLabel = "No" unless defined $listLabel ; die "No file spec" unless defined $file ; my $up_to_project = $ENV{SAF_UP_TO_PROJECT} ; my $up_to_rev = $ENV{SAF_UP_TO_REV} ; my $up_to_filter = $ENV{SAF_UP_TO_FILTER} ; my $path_filter = $ENV{SAF_PATH_FILTER} ; # Get file data my @filelog ; p4call(\@filelog,"filelog $file") ; die "No data for file \"$file\"" if @filelog == 0 ; # Get info about opened status p4call(*P,"opened -a $file 2>/dev/null") ; my %opened ; while(

) { chomp ; /\w+\#(\d+) - .* by (\w+)\@(\S+)/ or die "Can not read info from \"p4 opened\"" ; if(exists $opened{$1}) { $opened{$1} .= "
and $2\@$3" ; } else { $opened{$1} = "$2\@$3" ; } ; } ; close *P ; # Get list of labels (if $listLabel is set) my @labels ; if($listLabel eq "Yes") { p4call(*P,"labels") ; while(

) { /^Label (\S+)/ and do { push @labels,$1 ; } ; } close P ; } # Create hash containing labes by file name and version my %fileToLabels ; if(@labels > 0) { my $filelabels = "" ; foreach (@labels) { $filelabels .= " $file\@$_" ; } my @filesInLabels ; p4call(\@filesInLabels,"files $filelabels 2>&1") ; foreach (@filesInLabels) { my $lab = shift @labels ; /not in label/ or do { /^(\S+)/ ; if(defined $fileToLabels{$1}) { $fileToLabels{$1} .= "
$lab" ; } else { $fileToLabels{$1} = "$lab" ; } } } } ; print < File log for $file