#!/usr/bin/perl -w
# -*- perl -*-
use P4CGI ;
use strict ;
#
#################################################################
# CONFIGURATION INFORMATION
# All config info should be in P4CGI.pm
#
#################################################################
#
# P4 depot tree browser
#
#################################################################
# * Get path from argument
my $arg = P4CGI::cgi()->param("FSPC") ;
# canonicalize to either "/depot/..." or ""
$arg = "" unless defined $arg ;
$arg =~ s|^/*||;
$arg = "/$arg" if $arg;
# * Get HIDEDEL argument (Hide deleted files)
my $hidedel = P4CGI::cgi()->param("HIDEDEL") ;
$hidedel = "NO" unless defined $hidedel ;
$hidedel = "YES" unless $hidedel eq "NO" ;
# * Create link to changes for all files below
my $argnosp = &P4CGI::fixspaces($arg) ;
my $linkToAllbelow =
"<a href=\"" . P4CGI::CHB_URL() . "?CMD=changes&FSPC=/$argnosp/...\">View changes for all files below this point</a>";
# * Some variables...
my @subdirs ;
# directories information
my @files ;
# files information
# ** read dirs
my @tmp ;
&P4CGI::p4call(\@tmp,"dirs \"/$arg/*\" 2>/dev/null") ;
my $dir ;
foreach $dir (@tmp) {
my $nosp = &P4CGI::fixspaces($dir) ;
my $dirname ;
($dirname = $dir) =~ s/^.*\/// ;
push @subdirs,"<a href=\"" . P4CGI::DTB_URL() .
"?FSPC=${nosp}&HIDEDEL=$hidedel\">$dirname/</A><BR>" ;
} ;
&P4CGI::p4call(\@tmp,"files \"/$arg/*\" 2>/dev/null") ;
foreach (@tmp) {
/([^\#]+)\#(.*)/ ;
my $filename=$1 ;
my $info=$2 ;
$filename =~ s/^.*\/// ;
my ($rev,$inf) = split / - /,$info ;
my $file = $filename ;
if($inf =~ /^delete/) {
if($hidedel eq "YES") { next ; } ;
$file= "<STRIKE>$filename</STRIKE>";
} ;
$filename = &P4CGI::fixspaces($filename) ;
push @files,
"<a href=\"" . P4CGI::FLV_URL() .
"?FSPC=/$argnosp/$filename\">$file</A>\#$rev - $inf<BR>" ;
} ;
my $toggleHide = "<a href=\"".P4CGI::DTB_URL()."?FSPC=/$argnosp&HIDEDEL=" ;
if($hidedel eq "YES") {
$toggleHide .= "NO\">Show deleted files</A>" ;
}
else {
$toggleHide .= "YES\">Hide deleted files</A>" ;
}
print
"",
&P4CGI::start_page("Depot tree browser<br>/$arg",
&P4CGI::ul_list("<b>Subdir</b> -- Descend to subdir",
"<b>File</b> -- Show file log",
"$linkToAllbelow",
$toggleHide)) ;
# ** create a "file found" flag and set it to NO
my $fileFound = "N" ;
print
"",
&P4CGI::start_table(""),
&P4CGI::table_row("-type","th",
"-align","left",
undef,"Subdirs",undef,"Files") ;
# ** Create 1 or 2 colums for subdirs
my $subdirsC1 ;
my $subdirsC2 ;
if(@subdirs > 30) {
my $all = scalar(@subdirs) ;
my $half = int($all/2) ;
$subdirsC1 = join("\n",@subdirs[0..$half]) ;
$subdirsC2 = join("\n",@subdirs[$half+1..$all]) ;
}
else {
$subdirsC2 = join("\n",@subdirs) ;
}
# ** Create 1 or 2 colums for files
my $filesC1 ;
my $filesC2 ;
if(@files > 30) {
my $half = @files/2 ;
$filesC1 = join("\n",@files[0..$half]) ;
$filesC2 = join("\n",@files[$half+1..@files]) ;
}
else {
$filesC2 = join("\n",@files) ;
}
# ** print data
print
"",
&P4CGI::table_row("-valign","top",
$subdirsC1,$subdirsC2,$filesC1,$filesC2),
&P4CGI::end_table();
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/dtb.cgi | |||||
| #1 | 380 | heather_van_steenburgh | P4DB baseline | ||
| //guest/perforce_software/utils/p4db/dtb.cgi | |||||
| #1 | 11 | Perforce maintenance | Add Fredric Fredricson's depot browser, P4DB. | ||