ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/web/cgi-bin/cvslog.cgi
Revision: 1.6
Committed: Tue Jun 5 17:20:12 2001 UTC (23 years, 4 months ago) by tdb
Branch: MAIN
Changes since 1.5: +1 -2 lines
Log Message:
Uses the new script that fully checks out and updates a cvs local copy.

File Contents

# User Rev Content
1 tdb 1.5 #!/usr/bin/perl -w
2    
3     use CGI;
4     $query=new CGI;
5     my($period)=$query->param('period');
6     $period = "today" unless defined $period;
7    
8     my($firstdate);
9     if($period eq "days") {
10     my($days)=$query->param('days');
11     $days = 1 unless defined $days;
12     if ($days < 1) {$days = 1};
13     $heading = "i-scream CVS commits in the past $days day(s)";
14     $days--;
15     $firstdate = `date --date \"$days days ago\" \"+%Y/%m/%d\"`;
16     }
17     elsif($period eq "thisweek") {
18     $firstdate = "last Sunday";
19     $heading = "i-scream CVS commits this week";
20     }
21     else {
22     # default to "today only"
23     $firstdate = `/bin/date \"+%Y/%m/%d\"`;
24     $heading = "Today's i-scream CVS commits";
25     }
26 tdb 1.1
27     print "Content-type: text/html\n\n";
28    
29 tdb 1.5 my($cvs) = "/usr/bin/cvs";
30     my($cvs2clpath) = "/home/sites/www.i-scream.org.uk/bin/cvs2cl.pl";
31     my($cvsroot) = "/cvs/i-scream";
32     my($cvs2clargs) = "--stdout -r -b -t -w -U $cvsroot/CVSROOT/users -l \"-d'\>$firstdate'\" -g \"-d$cvsroot\" -g \"-Q\"";
33 tdb 1.6 my($updatecmd) = "/home/sites/www.i-scream.org.uk/bin/fullcvsupdate.sh";
34 tdb 1.5 my($logcmd) = "cd /home/sites/www.i-scream.org.uk/cvsscripttemp && $cvs2clpath $cvs2clargs";
35 tdb 1.1
36     print <<"END";
37     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
38    
39     <html>
40    
41     <head>
42 tdb 1.2 <title>The i-scream Project Daily Commit Log</title>
43 tdb 1.1 </head>
44    
45 tdb 1.5 <body bgcolor="#ffffff" link="#0000ff" alink="#3333cc" vlink="#3333cc" text="#000066">
46 tdb 1.1
47     <a href="http://www.i-scream.org.uk"><img border="0" src="../i-scream.gif"></a>
48    
49 tdb 1.5 <h2>$heading</h2>
50 tdb 1.1
51 tdb 1.5 END
52 tdb 1.1
53 tdb 1.5 print `$updatecmd`;
54    
55     my $modulelist = `ls $cvsroot`;
56     my(@modules) = split (/\s+/, $modulelist);
57    
58     foreach my $module (@modules) {
59    
60     print "<p><h3>$module module</h3>\n";
61     print "<a href=\"/cgi-bin/cvs/viewcvs.cgi/$module\">";
62     print "Browse i-scream &quot;$module&quot; cvs module</a>\n";
63     print "<pre>\n";
64    
65     my(@lines) = `$logcmd $module 2>&1`;
66     if(@lines == 0) {
67     print "There have been no commits in this module during this period.";
68     }
69     else {
70     foreach my $line (@lines) {
71     print HTML_encode($line);
72     }
73     }
74 tdb 1.1
75 tdb 1.5 print "</pre></p>\n\n";
76 tdb 1.1 }
77    
78     print <<"END";
79     </body>
80    
81     </html>
82     END
83    
84     exit 0;
85    
86     #------------------------------------------------------
87     # sub HTML_encode
88     #
89     # escape HTML characters that may cause problems when
90     # shown either in the <body> or within text fields.
91     #------------------------------------------------------
92     sub HTML_encode ($){
93     my ($encoded) = @_;
94     $encoded =~ s/&/&amp;/g;
95     $encoded =~ s/"/&quot;/g;
96     $encoded =~ s/</&lt;/g;
97     $encoded =~ s/>/&gt;/g;
98     return $encoded;
99     }