From: Rob H. <for...@us...> - 2003-04-22 17:40:39
|
Update of /cvsroot/sandweb/sandweb/lib/SandWeb In directory sc8-pr-cvs1:/tmp/cvs-serv26470/lib/SandWeb Modified Files: Browse.pm Log Message: committing my new images, and merging the patch from Claus Henrikson <lin...@ya...> that adds ViewCVS integration. Index: Browse.pm =================================================================== RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/Browse.pm,v retrieving revision 1.82 retrieving revision 1.83 diff -U2 -r1.82 -r1.83 --- Browse.pm 28 Feb 2003 11:04:06 -0000 1.82 +++ Browse.pm 22 Apr 2003 17:40:32 -0000 1.83 @@ -172,4 +172,5 @@ 'repo_name' => $repo_name, 'sort' => $sort, + 'viewcvs' => $viewcvs, ); @@ -213,4 +214,8 @@ Default: none. + + viewcvs (type: string) (required) + + The url to the local viewcvs installation RETURN CODES @@ -242,4 +247,7 @@ my $repo_name = $args{'repo_name'}; my $sort = $args{'sort'}; + my $viewcvs = $args{'viewcvs'}; + my $localstatus = $args{'localstatus'}; + my @localstatusoutput=@$localstatus; my $username = $self->_get_username(); @@ -250,4 +258,6 @@ my $sandbox = "$users_dir/$username/$repo_name/$module_name"; + my %Entries; + if (! $sandbox) { return "A sandbox must be defined."; @@ -282,4 +292,70 @@ } + + ## + # 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; + } + + + ## + # 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); + + # sanitize filename for HTTP + #Unsafe Characters; RFC 2068 + $name =~ s/%/%25/g; + $name =~ s/"/%22/g; + $name =~ s/#/%23/g; + $name =~ s/</%3C/g; + $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); + } + + my $counter=0; unless ($#return< 0) { @@ -306,4 +382,29 @@ $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} = '?'; + } + if ( $file->get_file_type() eq "Directory" ) { if ($repo_type eq "CVS") { @@ -317,4 +418,8 @@ $row_data{COLOR} = 1; } + $row_data{REVISION} = '-'; + #$row_data{TIMESTAMP} = ''; + #$row_data{OPTIONS} = ''; + $row_data{TAGDATE} = '-'; } elsif ( $file->get_file_type() eq "Text" ) { @@ -344,8 +449,10 @@ } } + $row_data{FILENAME} = $filename; $row_data{LOCATION} = $location; $row_data{MODULE_NAME} = "$module_name"; $row_data{REPO_NAME} = "$repo_name"; $row_data{PROGNAME} = $progname; + $row_data{VIEWCVS} = $viewcvs; push(@loop_data, \%row_data); @@ -573,4 +680,26 @@ return $self->{'log_obj'}; } + + +# Entrief file documentation: +# --------------------------- +# +#/name/revision/timestamp[+conflict]/options/tagdate +# +# where `[' and `]' are not part of the entry, but instead indicate that the `+' and conflict marker are optional. name is the name of the file within the directory. revision is the revision that the file in the working derives from, or `0' for an added file, or `-' followed by a revision for a removed file. timestamp is the timestamp of the file at the time that CVS created it; if the timestamp differs with the actual modification time of the file it means the file has been modified. It is stored in the format used by the ISO C asctime() function (for example, `Sun Apr 7 01:29:26 1996'). One may write a string which is not in that format, for example, `Result of merge', to indicate that the file should always be considered to be modified. This is not a special case; to see whether a file is modified a program should take the timestamp of the file and simply do a string compare with timestamp. If there was a conflict, conflict can be set to the modification time of the file after the file has been written with conflict markers (see section 10.3 Conflicts example). Thus if conflict is subsequently the same as the actual modification time of the file it means that the user has obviously not resolved the conflict. options contains sticky options (for example `-kb' for a binary file). tagdate contains `T' followed by a tag name, or `D' for a date, followed by a sticky tag or date. Note that if timestamp contains a pair of timestamps separated by a space, rather than a single timestamp, you are dealing with a version of CVS earlier than CVS 1.5 (not documented here). + +# The timezone on the timestamp in CVS/Entries (local or universal) should be the same as the operating system stores for the timestamp of the file itself. For example, on Unix the file's timestamp is in universal time (UT), so the timestamp in CVS/Entries should be too. On VMS, the file's timestamp is in local time, so CVS on VMS should use local time. This rule is so that files do not appear to be modified merely because the timezone changed (for example, to or from summer time). + +# If the first character of a line in `Entries' is `D', then it indicates a subdirectory. `D' on a line all by itself indicates that the program which wrote the `Entries' file does record subdirectories (therefore, if there is such a line and no other lines beginning with `D', one knows there are no subdirectories). Otherwise, the line looks like: + + + +# D/name/filler1/filler2/filler3/filler4 + +# where name is the name of the subdirectory, and all the filler fields should be silently ignored, for future expansion. Programs which modify Entries files should preserve these fields. + +# The lines in the `Entries' file can be in any order. + + 1; |