From: Nick J. <nje...@us...> - 2003-04-23 22:57:21
|
Update of /cvsroot/sandweb/sandweb/lib/SandWeb In directory sc8-pr-cvs1:/tmp/cvs-serv23344/lib/SandWeb Modified Files: Browse.pm Log Message: lots of code formatting (tabs) fixed some checking of undefined vars to cut down on warnings. Index: Browse.pm =================================================================== RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/Browse.pm,v retrieving revision 1.83 retrieving revision 1.84 diff -U2 -r1.83 -r1.84 --- Browse.pm 22 Apr 2003 17:40:32 -0000 1.83 +++ Browse.pm 23 Apr 2003 22:57:17 -0000 1.84 @@ -237,9 +237,9 @@ # Security check - my $secure = SandWeb::Security->new(); + my $secure = SandWeb::Security->new(); - my $location = $secure->path( - filename => "$unsafe_location" - ); + my $location = $secure->path( + filename => "$unsafe_location" + ); my $progname = $args{'progname'}; @@ -248,6 +248,6 @@ my $sort = $args{'sort'}; my $viewcvs = $args{'viewcvs'}; - my $localstatus = $args{'localstatus'}; - my @localstatusoutput=@$localstatus; + my $localstatus = $args{'localstatus'}; + my @localstatusoutput=@$localstatus; my $username = $self->_get_username(); @@ -258,5 +258,5 @@ my $sandbox = "$users_dir/$username/$repo_name/$module_name"; - my %Entries; + my %Entries; if (! $sandbox) { @@ -293,53 +293,53 @@ - ## - # Reading status in current directory - # - #$log->debug("Local status: @localstatusoutput"); - my @output=split( /File:/, $localstatusoutput[0]); - my $line; - my $line2; - for $line (@output) - { - $log->debug("line: ".$line."\n"); - #if ($line=~m/^([a-zA-Z0-9_\-\.]+) Status: ([a-zA-Z_\-]+)/) - $line2=$line; - if ($line=~m/^[ ]*([a-zA-Z0-9_\-\.]+)/) - { - $log->debug("File: ".$1); - } - my $name=$1; + ## + # Reading status in current directory + # + #$log->debug("Local status: @localstatusoutput"); + my @output=split( /File:/, $localstatusoutput[0]); + my $line; + my $line2; + for $line (@output) { + $log->debug("line: ".$line."\n"); + #if ($line=~m/^([a-zA-Z0-9_\-\.]+) Status: ([a-zA-Z_\-]+)/) + $line2=$line; + + if ($line=~m/^[ ]*([a-zA-Z0-9_\-\.]+)/) { + $log->debug("File: ".$1); + } + my $name=$1; - if ($line2=~m/Status: ([a-zA-Z0-9_\-\. ]+)/) - { - $log->debug("Status: ".$1); - } - $Entries{$name}{"STATUS"}=$1; - } + if ($line2=~m/Status: ([a-zA-Z0-9_\-\. ]+)/) { + $log->debug("Status: ".$1); + } + $Entries{$name}{"STATUS"}=$1; + } - ## - # Reading the CVS/Entries file if it is there - # - my $entries_file="$sandbox/$location/CVS/Entries"; - - $log->debug("debug: CVS/Entries file : $entries_file exists\n"); - if (open(EF, $entries_file)) - { - # The CVS/Entries file exists! - my @entries_file_content = <EF>; - $log->debug("debug: The CVS/Entries file $entries_file exists\n"); - my $line; - for $line (@entries_file_content) - { - $log->debug("debug: $line"); - my ($dir, $name, $revision, $timestamp_and_conflict, $options, $tagdate) = split( /\//, $line); - #cut prefixing T or D from tag if there - $tagdate =~ s/^[TD]//; - chomp($tagdate); + ## + # Reading the CVS/Entries file if it is there + # + my $entries_file="$sandbox/$location/CVS/Entries"; + + $log->debug("debug: CVS/Entries file : $entries_file exists\n"); + if (open(EF, $entries_file)) { + # The CVS/Entries file exists! + $log->debug("debug: The CVS/Entries file $entries_file exists\n"); + my @entries_file_content = <EF>; + close(EF); + my $line; + for $line (@entries_file_content) { + chomp $line; + $log->debug("splitting line: $line"); + my ($dir, $name, $revision, $timestamp_and_conflict, $options, $tagdate) = split( /\//, $line); + + if ($tagdate) { + #cut prefixing T or D from tag if there + $tagdate =~ s/^[TD]//; + } # sanitize filename for HTTP #Unsafe Characters; RFC 2068 - $name =~ s/%/%25/g; + $name =~ s/%/%25/g; $name =~ s/"/%22/g; $name =~ s/#/%23/g; @@ -347,13 +347,12 @@ $name =~ s/>/%3E/g; - #fill in a record in Entries hash - $Entries{$name}{"REVISION"} = $revision; - $Entries{$name}{"TIMESTAMP"}= $timestamp_and_conflict; - $Entries{$name}{"OPTIONS"} = $options; - $Entries{$name}{"TAGDATE"} = $tagdate; - $log->debug("dir $dir, name $name, revision $revision, timestamp $timestamp_and_conflict, options $options, tagdate \'$tagdate\'"); - } - close(EF); - } + #fill in a record in Entries hash + $Entries{$name}{"REVISION"} = $revision || ''; + $Entries{$name}{"TIMESTAMP"}= $timestamp_and_conflict || ''; + $Entries{$name}{"OPTIONS"} = $options || ''; + $Entries{$name}{"TAGDATE"} = $tagdate || ''; + $log->debug("results: name=$name, $Entries{$name}{'REVISION'}, timestamp_and_conflict=$Entries{$name}{'TIMESTAMP'}, options=$Entries{$name}{'OPTIONS'}, tagdate=$Entries{$name}{'TAGDATE'}\n"); + } + } @@ -382,28 +381,22 @@ $row_data{FILEAGE} = $file->get_age(); - ## - # put in version info - if (defined($Entries{$filename}{"REVISION"})) - { - $row_data{REVISION} = $Entries{$filename}{"REVISION"} ; - $row_data{STATUS} = $Entries{$filename}{"STATUS"} ; - #$row_data{TIMESTAMP} = $Entries{$filename}{"TIMESTAMP"}; - #$row_data{OPTIONS} = $Entries{$filename}{"OPTIONS"} ; - if ($Entries{$filename}{"TAGDATE"} eq "") - { - $row_data{TAGDATE} = "MAIN"; - } - else - { - $row_data{TAGDATE} = $Entries{$filename}{"TAGDATE"} ; - } - } - else - { - $row_data{REVISION} = '?'; - #$row_data{TIMESTAMP} = ''; - #$row_data{OPTIONS} = ''; - $row_data{TAGDATE} = '?'; - } + ## + # put in version info + if (defined($Entries{$filename}{"REVISION"})) { + $row_data{REVISION} = $Entries{$filename}{"REVISION"} ; + $row_data{STATUS} = $Entries{$filename}{"STATUS"} ; + #$row_data{TIMESTAMP} = $Entries{$filename}{"TIMESTAMP"}; + #$row_data{OPTIONS} = $Entries{$filename}{"OPTIONS"} ; + if ($Entries{$filename}{"TAGDATE"} eq "") { + $row_data{TAGDATE} = "MAIN"; + } else { + $row_data{TAGDATE} = $Entries{$filename}{"TAGDATE"} ; + } + } else { + $row_data{REVISION} = '?'; + #$row_data{TIMESTAMP} = ''; + #$row_data{OPTIONS} = ''; + $row_data{TAGDATE} = '?'; + } if ( $file->get_file_type() eq "Directory" ) { @@ -418,8 +411,8 @@ $row_data{COLOR} = 1; } - $row_data{REVISION} = '-'; - #$row_data{TIMESTAMP} = ''; - #$row_data{OPTIONS} = ''; - $row_data{TAGDATE} = '-'; + $row_data{REVISION} = '-'; + #$row_data{TIMESTAMP} = ''; + #$row_data{OPTIONS} = ''; + $row_data{TAGDATE} = '-'; } elsif ( $file->get_file_type() eq "Text" ) { @@ -591,9 +584,9 @@ # Security check - my $secure = SandWeb::Security->new(); + my $secure = SandWeb::Security->new(); - my $location = $secure->path( - filename => "$unsafe_location" - ); + my $location = $secure->path( + filename => "$unsafe_location" + ); my $progname = $args{'progname'}; |