version 1.98, 2003/02/22 15:05:56
|
version 1.150, 2003/02/28 19:50:59
|
Line 17 cvs -d :pserver:guest@mozdev.org:/cvs co
|
Line 17 cvs -d :pserver:guest@mozdev.org:/cvs co
|
</li> |
</li> |
</ul><?php $doNotCapitalise = 1; // $project='orbits'; // testing ?> |
</ul><?php $doNotCapitalise = 1; // $project='orbits'; // testing ?> |
|
|
<?php | <?php |
|
|
// $Id$ |
// $Id$ |
// $cvsId: sources.html,v 1.37 2003/02/21 00:43:24 cdn Exp svc$ | |
| |
require("include/CVS_PATHS"); |
require("include/CVS_PATHS"); |
|
|
define(MAX_READ_SIZE, 500000); |
define(MAX_READ_SIZE, 500000); |
define(MAX_READ, 100000); |
define(MAX_READ, 100000); |
|
|
$today = date("y/m/d"); | $today = date("y/m/d"); if (ereg('local', HOST) ): $today = '03/02/21'; endif; |
$day = (int)date('d'); |
$day = (int)date('d'); |
--$day; // --$day; | --$day; |
$yesterday = date("y/m/" . sprintf('%2u', $day)); | $yesterday = date("y/m/") . sprintf('%2u', $day); |
| $this_month = date("y/m/"); |
| |
| // $today = $this_month; // limit of 500k makes this not quite work |
| // $today = $yesterday; |
| |
$commit_log = "cvs@$project.mozdev.org"; |
$commit_log = "cvs@$project.mozdev.org"; |
|
|
// $today = '03/02/14'; | if(!$local_conf_commits) |
| |
if(!$local_conf_commits) { | |
print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n"; |
print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n"; |
} |
|
|
|
//BEGIN BLOCK |
//BEGIN BLOCK |
// | |
if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { | if(file_exists(COMMIT_PATH.$commit_log) && |
// if(file_exists('/tmp/commit_test') && $local_conf_commits) { | $local_conf_commits) { |
| |
| $size = filesize(COMMIT_PATH.$commit_log); |
|
|
$size = filesize(COMMIT_PATH.$commit_log); |
|
// $size = filesize('/tmp/commit_test'); |
|
$contents = array(); |
$contents = array(); |
if ($size > MAX_READ_SIZE) { |
if ($size > MAX_READ_SIZE) { |
// print "<!-- Log File is greater than 500K -->\n"; |
// print "<!-- Log File is greater than 500K -->\n"; |
Line 64 cvs -d :pserver:guest@mozdev.org:/cvs co
|
Line 65 cvs -d :pserver:guest@mozdev.org:/cvs co
|
fclose($fp); |
fclose($fp); |
} |
} |
|
|
if (!$contents) { | if (!$contents) |
// | |
$contents = file(COMMIT_PATH.$commit_log); |
$contents = file(COMMIT_PATH.$commit_log); |
// $contents = file('/tmp/commit_test'); // echo 'boing '; echo $contents; |
|
} |
|
|
|
// preprocess Tag: stuff | // preprocess Tag: stuff would be here if it didn't mess |
| // things up completely |
// /preprocess Tag: stuff | |
| |
$len=count($contents); |
$len=count($contents); |
$r = -1; |
$r = -1; |
|
|
|
|
$_project = $project; |
$_project = $project; |
|
|
if ( !isset($doNotCapitalise) ) { | if ( !isset($doNotCapitalise) ) |
$_project = PROJECT; |
$_project = PROJECT; |
} |
|
|
|
|
print '<script type="text/javascript" src="http://www.' . HOST . '/js/styleswitcher.js"></script>' . "\n"; |
|
|
print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n"; |
print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n"; |
// print '<h4 id="CVS-h4">' . "Yesterday's CVS Commits for " . $_project . " Project</h4>\n"; | print '<div id="CVS-table">' . "\n"; |
// print '<h4 id="CVS-h4">' . "Some day's CVS Commits for " . $_project . " Project</h4>\n"; | |
print '<table border="0" cellpadding="0" cellspacing="2" id="CVS-table">' . "\n"; | |
|
|
if($len) { |
if($len) { |
|
|
|
print '<p id="CVS-style-switch"><a href="#" onclick="setActiveStyleSheet(\'Default Checkins\'); return false;">change style to default</a> |' . "\n"; |
|
print '<a href="#" onclick="setActiveStyleSheet(\'Bonsai-esque Checkins\'); return false;"'; |
|
print ' title="Uses js and cookies">change style to bonsai</a></p>' . "\n"; |
|
|
|
print '<div class="CVS-block CVS-dft-hidden">' . "\n"; |
|
print '<div class="CVS-td-900 CVS-headers">Who</div>' . "\n"; |
|
print '<div class="CVS-td-f90 CVS-headers">When</div>' . "\n"; |
|
print '<div class="CVS-td-checkins">' . "\n" . |
|
'<div class="CVS-checkins CVS-headers" style="margin-top: 1px;">'; |
|
print 'What</div>' . "\n"; |
|
print '<div class="CVS-log CVS-headers" style="margin-top: 1px;">Why</div>' . "\n"; |
|
print '</div></div>'; |
|
print '<div style="clear: left; float: none;"></div>' . "\n"; |
|
|
for($i=0;$i<$len;$i++) { |
for($i=0;$i<$len;$i++) { |
if(ereg("Modified: www", $contents[$l]) && !$local_conf_commits) { | if(ereg("Modified: www", $contents[$l]) && |
| !$local_conf_commits) |
break; |
break; |
} |
|
|
|
// if(ereg(" Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) { | //start of parse of commitlog for $today / $yesterday |
// if(ereg(" Date: $yesterday", $contents[$i])) { | |
if(ereg(" Date: $today", $contents[$i])) { |
if(ereg(" Date: $today", $contents[$i])) { |
$r++; |
$r++; |
|
|
Line 109 cvs -d :pserver:guest@mozdev.org:/cvs co
|
Line 119 cvs -d :pserver:guest@mozdev.org:/cvs co
|
|
|
$_timestamp = '<a name="' . $_ts_link . '">'; |
$_timestamp = '<a name="' . $_ts_link . '">'; |
|
|
$result[$r] = '<tr class="CVS-tr-header" valign="top"><td class="CVS-td-900">' . "\n"; | $result[$r] = '<div class="CVS-block'; |
|
|
// who | if ($r == 0) |
$result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" . // who | $result[$r] .= ' CVS-last-block'; |
"</td></tr>\n" . | |
'<tr class="CVS-tr-date">' . | $result[$r] .= '"><div class="CVS-td-900">' . "\n"; |
'<td class="CVS-td-f90">' . "\n"; | |
| //who |
| $result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" . |
| "</div>\n" . |
| '<div class="CVS-td-f90">' . "\n"; |
|
|
$_time = htmlspecialchars($contents[$i]); |
$_time = htmlspecialchars($contents[$i]); |
|
|
// when |
// when |
$result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>'; // when | $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>'; |
| |
| $result[$r] = eregi_replace("(User|Date):{1}", '<span class="CVS-bonsai-hidden"' . ">\\1</span> ", $result[$r]); |
| |
| $result[$r] .= "\n</div>\n" . |
| '<div class="CVS-td-checkins">' . "\n" . |
| '<div class="CVS-checkins">' . "\n"; |
|
|
$result[$r] .= "\n</td></tr>\n" . | $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; |
'<tr class="CVS-tr-checkins"><td class="CVS-td-checkins">' . "\n"; | |
|
|
$webcvs = 'http://www.mozdev.org/source/browse/' . $project; | define (LOG_DIVS ,'</div>' . "\n" . '</div>' . "\n" . '<div class="CVS-log"><div class="CVS-bonsai-hidden">'); |
|
|
for($l=$i+1;$l<$len;$l++) { |
for($l=$i+1;$l<$len;$l++) { |
if(ereg(" Revision Changes Path", $contents[$l])) { | if(ereg(" Revision Changes Path", $contents[$l])) |
break; |
break; |
} |
|
|
|
if(ereg(" User:", $contents[$l])) { | if(ereg(" User:", $contents[$l])) |
break; |
break; |
} |
|
|
|
$checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", | $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", |
"<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l])); |
"<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l])); |
|
|
|
$checkins = eregi_replace("(bug[\ ]+[#%]?[0-9]{1,})", "<a href=\"\\1\">\\1</a>",$checkins); |
|
|
|
$checkins = eregi_replace('"bug[\ ]+[#%]?', '"http://' . HOST . '/bugs/show_bug.cgi?id=', $checkins); |
|
|
// ' Added: www/img background.png' |
// ' Added: www/img background.png' |
// ' Modified: www cdn.css' |
// ' Modified: www cdn.css' |
// ' Removed: www/protected sources.html' |
// ' Removed: www/protected sources.html' |
// ' www/compact index.html' |
// ' www/compact index.html' |
// ' mozpos/downloads - New directory' |
// ' mozpos/downloads - New directory' |
|
|
if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) || | if ( ereg("^[[:space:]]{1,3}Log\:", $checkins) ) { |
| $idRemoved = false; $_log_section = true; |
| $checkins = LOG_DIVS . $checkins; |
| } |
| |
| if ( ereg("^[[:space:]]{1,3}((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) || |
strstr($checkins, "New directory") |
strstr($checkins, "New directory") |
) { |
) { |
|
|
Line 153 cvs -d :pserver:guest@mozdev.org:/cvs co
|
Line 179 cvs -d :pserver:guest@mozdev.org:/cvs co
|
$identifier = trim(substr($checkins, 0, 15)); // may change to group |
$identifier = trim(substr($checkins, 0, 15)); // may change to group |
|
|
$checkins = substr($checkins, 15); |
$checkins = substr($checkins, 15); |
|
|
|
$_New_directory = false; |
} |
} |
else { |
else { |
$checkins = str_replace('- New directory', '-_New_directory', $checkins); |
$checkins = str_replace('- New directory', '-_New_directory', $checkins); |
|
|
$webcvs = 'http://www.mozdev.org/source/browse/'; | $webcvs = 'http://www.' . HOST . '/source/browse'; |
| |
| unset($identifier); |
| |
| $_New_directory = true; |
} |
} |
|
|
$_16 = strpos($checkins, ' '); |
$_16 = strpos($checkins, ' '); |
|
|
$_path = substr( $checkins, 0, $_16); |
$_path = substr( $checkins, 0, $_16); |
|
|
$checkins = ereg_replace('[[:space:]]{1,}', ' ', trim( substr ( $checkins, $_16 ) ) ); | $checkins = ereg_replace('[[:space:]]{1,}', ' ', |
| trim( substr ( $checkins, $_16 ) ) ); |
|
|
$checkinsA = explode(' ', $checkins); |
$checkinsA = explode(' ', $checkins); |
|
|
unset($checkins); |
unset($checkins); |
|
|
for($z=0; $z < count($checkinsA); ++$z) { | for($z=0; $z < count($checkinsA); ++$z) |
$checkinsA[$z] = trim($checkinsA[$z]); |
$checkinsA[$z] = trim($checkinsA[$z]); |
} |
|
|
|
if ( !empty($identifier) ) { | if ( !empty($identifier) ) |
$checkins = $identifier; | $checkins = '<span class="CVS-bonsai-hidden">' . $identifier . '</span>'; |
} | |
|
|
if ( !empty($_path)) { |
if ( !empty($_path)) { |
$webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important ! | // reset, important ! |
| $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; |
$webcvs .= '/' . $_path; |
$webcvs .= '/' . $_path; |
$_path_ = $_path; | $checkins .= ' <span class="CVS-bonsai-hidden"><a href="' . $webcvs; |
$checkins .= ' <a href="' . $webcvs; | $checkins .= '">' . $_path . '</a></span>'; |
$checkins .= '">' . $_path . '</a>'; | |
} |
} |
|
|
for($y=0; $y < count($checkinsA); ++$y) { | $Y = count($checkinsA); |
|
|
if (ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag || | for($y=0; $y < $Y; ++$y) { |
| |
| if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag || |
strstr($checkinsA[$y], '-_New_directory') |
strstr($checkinsA[$y], '-_New_directory') |
) { | ) |
$TAG = true; |
$TAG = true; |
} | else |
else { | |
$TAG = false; |
$TAG = false; |
} | |
| $checkins .= ' <span'; |
| |
| if ( !$_New_directory ) |
| $checkins .= ' class="CVS-dft-inline"'; |
| |
| if ( strstr($checkinsA[$y+1], '-_New_directory') ) |
| $checkins .= ' class="CVS-dft-inline"'; |
| |
| $checkins .= '>'; |
|
|
if(!$TAG) { |
if(!$TAG) { |
$checkins .= ' <a href="' . $webcvs . '/'; | $checkins .= '<a href="' . $webcvs . '/'; |
|
|
if( $identifier == 'Removed:' || $idRemoved ) { | if( $identifier == 'Removed:' || $idRemoved ) |
$checkins .= 'Attic/'; |
$checkins .= 'Attic/'; |
} |
|
|
|
$checkins .= $checkinsA[$y] . '">'; |
$checkins .= $checkinsA[$y] . '">'; |
} |
} |
else { | |
$checkins .= ' '; | if ( !$_New_directory && !$TAG ) { |
| $checkins .= '<span class="CVS-dft-hidden">'; // $project / $_path |
| $_webcvs = str_replace('http://www.' . HOST . '/source/browse/', '', $webcvs); |
| |
| if ( strlen($_webcvs) > 15 ) |
| $checkins .= substr($_webcvs, 0, 12) . '...' . substr($_webcvs, strrpos($_webcvs, '/')); |
| else |
| $checkins .= $_webcvs; |
| |
| if( $identifier == 'Removed:' || $idRemoved ) |
| $checkins .= '/Attic'; |
| |
| $checkins .= '/</span>'; |
} |
} |
|
|
$checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]); |
$checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]); |
|
|
$checkins .= $checkinsA[$y]; |
$checkins .= $checkinsA[$y]; |
|
|
if ( ereg("Tag\:$", trim($checkinsA[$y])) && empty($checkinsA[$y+1])) { | if (ereg("Tag\:$", trim($checkinsA[$y])) && |
$_tag = true; | empty($checkinsA[$y+1])) |
} | $_tag = true; |
else { | else |
$_tag = false; |
$_tag = false; |
} |
|
|
|
if(!$TAG) { | if (!$TAG) |
$checkins .= '</a>'; | $checkins .= '</a>'; |
} | |
| $checkins .= '</span>'; |
|
|
} |
} |
|
|
if ( $identifier == 'Removed:' ) { | if ($_New_directory) |
| $checkins .= LOG_DIVS; |
| |
| if ( $identifier == 'Removed:' || $idRemoved ) |
$idRemoved = true; |
$idRemoved = true; |
} | else |
else { | |
$idRemoved = false; |
$idRemoved = false; |
} |
|
|
|
} |
} |
|
|
|
$checkins = trim( str_replace('</span> <span>', ' ', $checkins) ); |
|
|
|
if ( !ereg('^<d', $checkins) ) |
|
$checkins = '<div class="CVS-div-checkins">' . $checkins; |
// what |
// what |
$result[$r] .= '<div class="CVS-div-checkins">' . $checkins . "</div>\n"; // what | if ( !empty( $checkins ) ) |
| $result[$r] .= $checkins . "</div>\n"; // what |
| |
| |
} |
} |
|
|
$result[$r] .= "</td></tr>\n"; | if ( $_log_section || $_New_directory ) { |
| $_log_section = false; |
| $result[$r] .= '</div>'; |
| } |
| |
| $result[$r] = str_replace('<div class="CVS-bonsai-hidden"></div>', |
| '<div class="CVS-bonsai-hidden"></div> ', $result[$r]); |
| $result[$r] = str_replace('<div class="CVS-bonsai-hidden"> Log:</div>' . "\n" . |
| '<div class="CVS-div-checkins"></div>', '<div class="CVS-bonsai-hidden"> Log:</div> ' . |
| "\n" . '<div class="CVS-div-checkins"></div>', $result[$r]); |
| |
| $result[$r] .= "</div>\n"; |
| $result[$r] .= "</div>\n"; |
| $result[$r] .= '<div style="clear: left; float: none;"></div>' . "\n"; |
} |
} |
|
|
|
// end of parse of commitlog for $today / $yesterday |
|
|
} |
} |
} |
} |
|
|
if(!$result) { | if (!$result) { |
print '<tr><td id="CVS-no-commits">There are no new commits today</td></tr>' . "\n"; | print '<div id="CVS-no-commits">There are no new commits today</div>'."\n"; |
} else { | } else { |
$reversed=array_reverse($result); | $reversed=array_reverse($result); |
for($i=0;$i<count($result);$i++) | for ($i=0;$i<count($result);$i++) |
PRINT $reversed[$i]; | print $reversed[$i]; |
} | } |
| |
| print "</div>\n\n"; |
| |
| } // END BLOCK |
| |
| echo '<p />'; |
|
|
print "</table>\n\n"; | $author = 'orbit@cdn.gs'; |
| include(NOTES); |
|
|
} //END BLOCK |
|
?> |
?> |