sff.cgi #2

  • //
  • guest/
  • heather_van_steenburgh/
  • perforce/
  • utils/
  • p4db_0.99f/
  • sff.cgi
  • View
  • Commits
  • Open Download .zip Download (3 KB)
#!/usr/bin/perl -w
# -*- perl -*-
use P4CGI ;
use strict ;
#
#################################################################
#  CONFIGURATION INFORMATION 
#  All config info should be in P4CGI.pm
#
#################################################################
#
#  P4 search for file
#  Search depot for files matching spec
#
#################################################################

# Get file spec argument
my $filespec = P4CGI::cgi()->param("FSPC") ;
$filespec = "" unless defined $filespec ;

my $label = P4CGI::cgi()->param("LABEL") ;
if(!defined $label) {
    $label = "" ;
}
my $filedesc ;
my $showDiffSelection="Y" ;
if($filespec eq "") {
    $filedesc = " <small>label</small><br><code>$label</code>" ;
    $showDiffSelection= undef ;
}
else {
    $filedesc = "<br><code>$filespec</code>" ;
    if($label ne "") {
	$filedesc .= "<br><small>in label</small><br><code>$label</code>" ;
    }
}
if($label ne "") {
    $label = "\@$label" ;
}
				# Add //... if not there
if($filespec !~ /^\/\//) {
    $filespec = "//...$filespec" ;
}				
while($filespec =~ s/\.\.\.\.\.\./\.\.\./) { ; } ;
while($filespec =~ s/\*\*/\*/) { ; } ;

				# Check if file exists
my @matches ;
&P4CGI::p4call(\@matches, "files \"$filespec$label\"" );

print "",
    &P4CGI::start_page("<small>Search result for</small>$filedesc",
		       &P4CGI::ul_list("<b>Filename</b> -- see the complete file history",
				       "<b>Revision Number</b> -- see the file text",
				       "<b>Action</b> -- see the deltas (diffs)",
				       "<b>Change</b> -- see the complete change description, including other files")),
    &P4CGI::start_table("cellpadding=1"),
    &P4CGI::table_row("-type","th",
		      "-align","left",
		      "File","Rev","Action","Change");

    if(scalar(@matches) == 0) {
	print  "<font color=red>No files found matching $filespec</font>\n" ;
    }
    else {
	print "<font color=green>",scalar(@matches)," files found:</font>" ;
	my $f ;
	foreach $f (@matches) {
	    $f =~ /([^\#]+)\#(\d+) - (\w+) change (\d+)/ ;
	    my ($name,$rev,$act,$change)=($1,$2,$3,$4) ;
	    print 
		"",
		&P4CGI::table_row(&P4CGI::ahref("-url",P4CGI::FLV_URL(),
						&P4CGI::fixspaces("FSPC=$name"),
						$name),
				  &P4CGI::ahref("-url",P4CGI::FV_URL(),
						&P4CGI::fixspaces("FSPC=$name"),
						"REV=$rev",
						$rev),
				  &P4CGI::ahref("-url",P4CGI::FDV_URL(),
						&P4CGI::fixspaces("FSPC=$name"),
						"REV=$rev",
						"ACT=$act",
						$act),
				  &P4CGI::ahref("-url",P4CGI::CHV_URL(),
						"CH=$change",
						$change)) ;
	}  ;
	print "",&P4CGI::end_table() ;
	my @files ;
	my %filesToFiles ;
	foreach $f (@matches) {
	    $f =~ /([^\#]+)\#(\d+) - (\w+) change (\d+)/ ;
	    my ($name,$rev,$act,$change)=($1,$2,$3,$4) ;
	    if($act ne "delete"){
		push @files,"$name\#$rev" ;
	    }
	} ;
	if(defined $showDiffSelection and @files > 1) {
	    print 
		&P4CGI::cgi()->startform("-action",&P4CGI::FDV_URL(),
					 "-method","GET"),
		&P4CGI::cgi()->hidden("-name","ACT",
				      "-value","edit"),
		"View diff between:<br>",
		&P4CGI::cgi()->popup_menu(-name => "FSPC",
					  -values => \@files),
		"and<br>",
		&P4CGI::cgi()->popup_menu(-name => "FSPC2",
					  -values => \@files),
		&P4CGI::cgi()->submit("-name","ignore",
				      "-value"=>"Go"),
		&P4CGI::cgi()->endform() ;
	} ;	
    } ;
print
    "",    
    &P4CGI::end_page() ;

#
# That's it folks
#








# Change User Description Committed
#2 382 heather_van_steenburgh Bring up to 0.99f level
#1 381 heather_van_steenburgh The version of P4DB in the public depot isn't 0.99f.
Branch for 0.99f
//guest/heather_van_steenburgh/perforce/utils/p4db/sff.cgi
#1 380 heather_van_steenburgh P4DB baseline