--- cdn/www/sources.html 2003/02/22 22:28:33 1.105 +++ cdn/www/sources.html 2003/03/10 17:39:22 1.158 @@ -15,38 +15,120 @@ cvs -d :pserver:guest@mozdev.org:/cvs co - + -' . $local_conf_commits_msg . "\n"; + + //BEGIN BLOCK + + if(file_exists(COMMIT_PATH.$commit_log) && + $local_conf_commits) { + + $size = filesize(COMMIT_PATH.$commit_log); + + $contents = array(); + if ($size > MAX_READ_SIZE) { + // print "\n"; + + $fp = fopen (COMMIT_PATH.$commit_log, "r"); + fseek($fp, $size - MAX_READ); + if ($contents) { + print "$contents\n"; + exit; + } + $tok = strtok(fread($fp, MAX_READ),"\n"); + while ($tok) { + array_push($contents, $tok); + $tok = strtok("\n"); + } + fclose($fp); + } + + if (!$contents) + $contents = file(COMMIT_PATH.$commit_log); + +// debug + +echo '
';
+
+$i = 0;
+
+while($contents[$i])
+{
+
+// echo $contents[$i]; // . "\n";
+
+++$i;
+
+}
 
-  $result[0] = 'cvs_parse($contents, ' . $day . ', ' . $len . ')';
+echo '
'; +// /debug + + // preprocess Tag: stuff would be here if it didn't mess + // things up completely + + $len=count($contents); $r = -1; + + $_project = $project; + + if ( !isset($doNotCapitalise) ) + $_project = PROJECT; + + print '' . "\n"; + + print '

' . "Today's CVS Commits for " . $_project . " Project

\n"; + print '
' . "\n"; - // if(ereg(" Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) { - // if(ereg(" Date: $yesterday", $contents[$i])) { - // if(ereg(" Date: $today", $contents[$i])) { + if($len) { + + print '

change style to default |' . "\n"; + print 'change style to bonsai

' . "\n"; + + print '
' . "\n"; + print '
Who
' . "\n"; + print '
When
' . "\n"; + print '
' . "\n" . + '
'; + print 'What
' . "\n"; + print '
Why
' . "\n"; + print '
'; + print '
' . "\n"; - if(ereg(" Date: $day", $contents)) { - $r++; + for($i=0;$i<$len;$i++) { + if(ereg("Modified: www", $contents[$l]) && + !$local_conf_commits) + break; - $result[1] = 'cvs_parse(); : '; +//start of parse of commitlog for $today / $yesterday + + if(ereg(" Date: $today", $contents[$i])) { + $r++; $yy = substr(YEAR, 0, 2); @@ -57,222 +139,229 @@ function cvs_parse ($contents, $day, $le $_timestamp = ''; - $result[$r] = '' . "\n"; + $result[$r] = '
" . $_timestamp . htmlspecialchars($contents[$i-1]) . "\n" . // who - "\n" . - '' . - '' . "\n"; + $result[$r] .= '">
' . "\n"; + +//who + $result[$r] .= "" . $_timestamp . htmlspecialchars($contents[$i-1]) . "\n" . + "
\n" . + '
' . "\n"; $_time = htmlspecialchars($contents[$i]); // when - $result[$r] .= '' . $_time . ''; // when + $result[$r] .= '' . $_time . ''; + + $result[$r] = eregi_replace("(User|Date):{1}", '\\1 ", $result[$r]); + + $result[$r] .= "\n
\n" . + '
' . "\n" . + '
' . "\n"; - $result[$r] .= "\n\n" . - '' . "\n"; + $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; - $webcvs = 'http://www.mozdev.org/source/browse/' . $project; + define (LOG_DIVS ,'
' . "\n" . '
' . "\n" . '
'); for($l=$i+1;$l<$len;$l++) { - if(ereg(" Revision Changes Path", $contents[$l])) { + if(ereg(" Revision Changes Path", $contents[$l])) break; - } - if(ereg(" User:", $contents[$l])) { + if(ereg(" User:", $contents[$l])) break; - } - $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", + $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", "\\1", htmlspecialchars($contents[$l])); + $checkins = eregi_replace("(bug[\ ]+[#%]?[0-9]{1,})", "\\1",$checkins); + + $checkins = eregi_replace('"bug[\ ]+[#%]?', '"http://' . HOST . '/bugs/show_bug.cgi?id=', $checkins); + // ' Added: www/img background.png' // ' Modified: www cdn.css' // ' Removed: www/protected sources.html' // ' www/compact index.html' // ' mozpos/downloads - New directory' - if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) || - strstr($checkins, "New directory") + 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") || ereg("^[[:space:]]{1,3}N\ ", $checkins) ) { if ( !strstr($checkins, "New directory") ) { $identifier = trim(substr($checkins, 0, 15)); // may change to   group $checkins = substr($checkins, 15); + + $_New_directory = false; + } + elseif ( ereg("^[[:space:]]{1,3}N\ ", $checkins) ) { + + $webcvs = 'http://www.' . HOST . '/source/browse'; + + unset($identifier); + } else { $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, ' '); $_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); unset($checkins); - for($z=0; $z < count($checkinsA); ++$z) { + for($z=0; $z < count($checkinsA); ++$z) $checkinsA[$z] = trim($checkinsA[$z]); - } - if ( !empty($identifier) ) { - $checkins = $identifier; - } + if ( !empty($identifier) ) + $checkins = '' . $identifier . ''; if ( !empty($_path)) { - $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important ! + // reset, important ! + $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; $webcvs .= '/' . $_path; - $_path_ = $_path; - $checkins .= ' ' . $_path . ''; + $checkins .= ' ' . $_path . ''; } - for($y=0; $y < count($checkinsA); ++$y) { + $Y = count($checkinsA); + + for($y=0; $y < $Y; ++$y) { - if (ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag || + if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag || strstr($checkinsA[$y], '-_New_directory') - ) { + ) $TAG = true; - } - else { + else $TAG = false; - } - if (!$TAG) { - $checkins .= ' '; } - else { - $checkins .= ' '; + + if ( !$_New_directory && !$TAG ) { + $checkins .= ''; // $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 .= '/'; } $checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]); $checkins .= $checkinsA[$y]; - if ( ereg("Tag\:$", trim($checkinsA[$y])) && empty($checkinsA[$y+1])) { - $_tag = true; - } - else { + if (ereg("Tag\:$", trim($checkinsA[$y])) && + empty($checkinsA[$y+1])) + $_tag = true; + else $_tag = false; - } - if(!$TAG) { - $checkins .= ''; - } + if (!$TAG) + $checkins .= ''; + + $checkins .= ''; } - if ( $identifier == 'Removed:' ) { + if ($_New_directory) + $checkins .= LOG_DIVS; + + if ( $identifier == 'Removed:' || $idRemoved ) $idRemoved = true; - } - else { + else $idRemoved = false; - } } -// what - $result[$r] .= '
' . $checkins . "
\n"; // what - } + $checkins = trim( str_replace(' ', ' ', $checkins) ); - $result[$r] .= "\n"; - } - - return $result; -} + if ( !ereg('^\n"; // what - // $today = '03/02/14'; - if(!$local_conf_commits) { - print '' . $local_conf_commits_msg . "\n"; - } + } - //BEGIN BLOCK - // - if(file_exists(COMMIT_PATH.$commit_log) && $local_conf_commits) { - // if(file_exists('/tmp/commit_test') && $local_conf_commits) { + if ( $_log_section || $_New_directory ) { + $_log_section = false; + $result[$r] .= '
'; + } - $size = filesize(COMMIT_PATH.$commit_log); - // $size = filesize('/tmp/commit_test'); - $contents = array(); - if ($size > MAX_READ_SIZE) { - // print "\n"; + $result[$r] = str_replace('
', + '
 ', $result[$r]); + $result[$r] = str_replace('
Log:
' . "\n" . + '
', '
Log:
 ' . + "\n" . '
', $result[$r]); + + $result[$r] .= "
\n"; + $result[$r] .= "
\n"; + $result[$r] .= '
' . "\n"; + } + +// end of parse of commitlog for $today / $yesterday - $fp = fopen (COMMIT_PATH.$commit_log, "r"); - fseek($fp, $size - MAX_READ); - if ($contents) { - print "$contents\n"; - exit; - } - $tok = strtok(fread($fp, MAX_READ),"\n"); - while ($tok) { - array_push($contents, $tok); - $tok = strtok("\n"); } - fclose($fp); - } - - if (!$contents) { - // - $contents = file(COMMIT_PATH.$commit_log); - // $contents = file('/tmp/commit_test'); // echo 'boing '; echo $contents; } - // preprocess Tag: stuff - - // /preprocess Tag: stuff - - $len=count($contents); - - $_project = $project; - - if ( !isset($doNotCapitalise) ) { - $_project = PROJECT; + if (!$result) { + print '
There are no new commits today
'."\n"; + } else { + $reversed=array_reverse($result); + for ($i=0;$i' . "Today's CVS Commits for " . $_project . " Project\n"; - // print '

' . "Yesterday's CVS Commits for " . $_project . " Project

\n"; - // print '

' . "Some day's CVS Commits for " . $_project . " Project

\n"; - print '' . "\n"; - if($len) { - for($i=0;$i<$len;$i++) { - if(ereg("Modified: www", $contents[$i]) && !$local_conf_commits) - break; - -//start of parse of commitlog for $today / $yesterday - - $result = cvs_parse($contents[$i], $today, $len); + print "\n\n"; -// end of parse of commitlog for $today / $yesterday - - } - } + } // END BLOCK - if(!$result) { - print '' . "\n"; - } else { - $reversed=array_reverse($result); - for($i=0;$i'; - print "
There are no new commits today
\n\n"; +include(NOTES); - } //END BLOCK ?>