--- cdn/www/sources.html 2003/02/21 13:40:30 1.48 +++ cdn/www/sources.html 2003/02/27 00:16:07 1.125 @@ -15,35 +15,33 @@ 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) { - // if(file_exists('/tmp/commit_test') && $local_conf_commits) { + + if(file_exists(COMMIT_PATH.$commit_log) && + $local_conf_commits) { + + $size = filesize(COMMIT_PATH.$commit_log); - $size = filesize(COMMIT_PATH.$commit_log); - // $size = filesize('/tmp/commit_test'); $contents = array(); if ($size > MAX_READ_SIZE) { // print "\n"; @@ -63,46 +61,77 @@ cvs -d :pserver:guest@mozdev.org:/cvs co } if (!$contents) - { $contents = file(COMMIT_PATH.$commit_log); - // $contents = file('/tmp/commit_test'); - } - + + // 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 '

' . "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"; + print '

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

\n"; + print '
' . "\n"; if($len) { + + print '
' . "\n"; + print '
Who
' . "\n"; + print '
When
' . "\n"; + print '
' . "\n" . + '
' . "\n"; + print 'What
'; + print '
'; + print 'Why
'; + print '
' . "\n"; + 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; - // if(ereg(" Date: [0-9]{2}/[0-9]{2}/[0-9]{2}", $contents[$i])) { - // if(ereg(" Date: $yesterday", $contents[$i])) { +//start of parse of commitlog for $today / $yesterday + if(ereg(" Date: $today", $contents[$i])) { $r++; - $result[$r] = - '
\n" . - '' . - '\n" . - '\n"; + if ( $_log_section ) { + $_log_section = false; + $result[$r] .= ''; + } + + $result[$r] .= "\n"; + $result[$r] .= "\n"; + $result[$r] .= '
' . "\n"; } + +// end of parse of commitlog for $today / $yesterday + } } - if(!$result) { - print '' . "\n"; - } else { - $reversed=array_reverse($result); - for($i=0;$iThere are no new commits today'."\n"; + } else { + $reversed=array_reverse($result); + for ($i=0;$i\n\n"; + print "\n\n"; - } //END BLOCK + } // END BLOCK ?>
' . "\n" . - "" . htmlspecialchars($contents[$i-1]) . "\n" . - "
' . "\n" . htmlspecialchars($contents[$i]) . - "\n
' . "\n"; - $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // . '/'; + $yy = substr(YEAR, 0, 2); + + $_timestamp = str_replace('Date: ', '', ltrim($contents[$i])); + $_timestamp = str_replace("\n", '', $_timestamp); + + $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp); + + $_timestamp = ''; + + $result[$r] = '
\n" . + '
' . "\n"; + + $_time = htmlspecialchars($contents[$i]); + +// when + $result[$r] .= '' . $_time . ''; + + $result[$r] = eregi_replace("(User|Date):{1}", '\\1 ", $result[$r]); + + $result[$r] .= "\n
\n" . + '
' . "\n" . + '
' . "\n"; + + $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; for($l=$i+1;$l<$len;$l++) { if(ereg(" Revision Changes Path", $contents[$l])) @@ -111,85 +140,173 @@ cvs -d :pserver:guest@mozdev.org:/cvs co if(ereg(" User:", $contents[$l])) break; - $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", - "\\1", htmlspecialchars($contents[$l])); + $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})", + "\\1", htmlspecialchars($contents[$l])); // ' Added: www/img background.png' // ' Modified: www cdn.css' // ' Removed: www/protected sources.html' - // ' www/compact index.html' ? - - if ( ereg("((Added|Modified|Removed):)", $checkins) || ereg("[[:space:]]{9}", $checkins) ) - { + // ' www/compact index.html' + // ' mozpos/downloads - New directory' - $identifier = trim(substr($checkins, 0, 15)); // echo $identifier . '

'; + if ( ereg("^[[:space:]]{1,3}Log\:", $checkins) ) { + $idRemoved = false; $_log_section = true; + // $checkins = eregi_replace("(Log):{1}", '\\1", $checkins); + $checkins = '

' . "\n" . '
' . "\n" . + '
' . $checkins; + } - $checkins = substr($checkins, 15); // echo $checkins . '

'; + if ( ereg("^[[:space:]]{1,3}((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) || + strstr($checkins, "New directory") + ) { - // find first non-space character - // if > 16, chances are the files are in the directory defined in the previous line ? + if ( !strstr($checkins, "New directory") ) { + $identifier = trim(substr($checkins, 0, 15)); // may change to   group - $_16 = strpos($checkins, ' '); // echo '$_16 ' . $_16 . '

'; + $checkins = substr($checkins, 15); - $_path = substr( $checkins, 0, $_16); // echo $_path . '

'; + $_New_directory = false; + } + else { + $checkins = str_replace('- New directory', '-_New_directory', $checkins); - // if ( $_16 > 16 ) // not going to happen frequently : ) - $checkins = ereg_replace('[[:space:]]{1,}', ' ', trim( substr ( $checkins, $_16 ) ) ); + $webcvs = 'http://www.' . HOST . '/source/browse'; - $__path = trim($_path); + unset($identifier); - if ( !empty( $__path ) ) - { - $chkA1 = $_path; + $_New_directory = true; } + $_16 = strpos($checkins, ' '); + + $_path = substr( $checkins, 0, $_16); + + $checkins = ereg_replace('[[:space:]]{1,}', ' ', + trim( substr ( $checkins, $_16 ) ) ); + $checkinsA = explode(' ', $checkins); unset($checkins); for($z=0; $z < count($checkinsA); ++$z) - { $checkinsA[$z] = trim($checkinsA[$z]); - } if ( !empty($identifier) ) - $checkins = $identifier; + $checkins = '' . $identifier . ''; - if ( !empty($_path)) - { - $webcvs = 'http://www.mozdev.org/source/browse/' . $project; // reset important ! + if ( !empty($_path)) { + // reset, important ! + $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; $webcvs .= '/' . $_path; - $_path_ = $_path; - $checkins .= ' ' . $_path . ''; + $checkins .= ' ' . $_path . ''; } - for($y=0; $y < count($checkinsA); ++$y) - { - $checkins .= ' '; - $checkins .= $checkinsA[$y] . ''; + $Y = count($checkinsA); + + for($y=0; $y < $Y; ++$y) { + + if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag || + strstr($checkinsA[$y], '-_New_directory') + ) + $TAG = true; + else + $TAG = false; + + $checkins .= ' '; + } + + if ( !$_New_directory ) { + $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 + $_tag = false; + + if (!$TAG) + $checkins .= ''; + + $checkins .= ''; + } + if ( $identifier == 'Removed:' || $idRemoved ) + $idRemoved = true; + else + $idRemoved = false; + } - $result[$r] .= '

' . $checkins . - "
\n"; + $checkins = trim( str_replace(' ', ' ', $checkins) ); + + if ( !ereg('^\n"; // what + + } - $result[$r] .= "
There are no new commits today