#!/usr/bin/perl -w
# -*- perl -*-
use P4CGI ;
use strict ;
#
#################################################################
# CONFIGURATION INFORMATION
# All config info should be in P4CGI.pm
#
#################################################################
#
# P4 label diff viewer
# View diff between two labels
#
#################################################################
# Define variables set by command arguments
my $label1 ; # Labels to diff
my $label2 ;
my $showSame ; # defined if files that are the same in both labels
# should be listed
my $showNotSame ; # defined if files that are not the same in botha labels
# should be listed
my $showDiff ; # defined if files that exists only in one of the labels
# shold be displayed
# Get arguments
$label1 = P4CGI::cgi()->param("LABEL1") ;
&P4CGI::bail("No label first specified") unless defined $label1 ;
$label2 = P4CGI::cgi()->param("LABEL2") ;
&P4CGI::bail("No label second specified") unless defined $label2 ;
$showSame = P4CGI::cgi()->param("SHOWSAME") ;
undef $showSame if $showSame ne "Y" ;
$showNotSame = P4CGI::cgi()->param("SHOWNOTSAME") ;
undef $showNotSame if $showNotSame ne "Y" ;
$showDiff = P4CGI::cgi()->param("SHOWDIFF") ;
undef $showDiff if $showDiff ne "Y" ;
#
# Start page
#
print
"",
&P4CGI::start_page("Diff between label
$label1 and $label2","") ;
# Define a typeglob for use as file handle
local *P4 ;
#
# Get basic data for labels
#
my ($date1,$time1,$owner1,$desc1,$opt1,$view1,@view1) = &getLabelData($label1) ;
my ($date2,$time2,$owner2,$desc2,$opt2,$view2,@view2) = &getLabelData($label2) ;
#
# Print basic label data
#
print "", # Start table
&P4CGI::start_table(""),
&P4CGI::table_row(-type => "th",
-bgcolor=>"white",
"",$label1,$label2),
&P4CGI::table_row({-align => "right",
-text => "Date:"},
{-bgcolor => "white",
-text => "$time1 $date1"},
{-bgcolor => "white",
-text => "$time2 $date2"});
if($owner1 eq $owner2) {
print "",
&P4CGI::table_row({-align => "right",
-text => "Owner:"},
undef,
{-bgcolor => "white",
-align => "center",
-text =>$owner2});
}
else {
print "",
&P4CGI::table_row({-align => "right",
-text => "Owner:"},
{-bgcolor => "white",
-text =>$owner1},
{-bgcolor => "white",
-text =>$owner2});
}
if($desc1 eq $desc2) {
print "",
&P4CGI::table_row({-align=>"right",
-valign=>"top",
-text=>"Description"},
undef,
{-bgcolor => "white",
-text =>$desc2});
}
else {
print "",
&P4CGI::table_row({-align=>"right",
-valign=>"top",
-text=>"Description"},
{-bgcolor => "white",
-text =>$desc1},
{-bgcolor => "white",
-text =>$desc2});
}
if(( $opt1 ne "") or
( $opt2 ne "")) {
if($opt1 eq $opt2) {
print "",
&P4CGI::table_row({-align => "right",
-text => "Options:"},
undef,
{-bgcolor => "white",
-text =>$opt2});
}
else {
print "",
&P4CGI::table_row({-align => "right",
-text => "Options:"},
{-bgcolor => "white",
-text =>$opt1},
{-bgcolor => "white",
-text =>$opt2});
}
} ;
if($view1 eq $view2) {
print "",
&P4CGI::table_row({-align => "right",
-valign=>"top",
-text => "View:"},
undef,
{-bgcolor => "white",
-text =>$view2});
}
else {
print "",
&P4CGI::table_row({-align => "right",
-valign=>"top",
-text => "View:"},
{-bgcolor => "white",
-text =>$view1},
{-bgcolor => "white",
-text =>$view2});
}
print "",
&P4CGI::end_table(),
"