Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 16. október 2026

Rozdiely pre scripts/php/parsecvs/parsecvs.php medzi verziami 1.10 a 1.11

verzia 1.10, 2002/05/30 15:58:29 verzia 1.11, 2002/05/30 16:23:33
Riadok 1 
Riadok 1 
 <?php  <?php
   
           // Specify input/output streams (ie. files, sockets or std's)
   
         $input_file  = 'php://stdin';          $input_file  = 'php://stdin';
         $output_file = 'php://stdout';          $output_file = 'php://stdout';
   
         $begin_line = '----------------------------------------------';          $begin_line = '----------------------------------------------';
   
         function my_array_walk($x) {          function my_array_walk($x) {
                   // This will do array_unique() on third-level values of $x
                 $ik = array_keys($x);                  $ik = array_keys($x);
                 for ($i = 0; $i < sizeof($ik); $i++) {                  for ($i = 0; $i < sizeof($ik); $i++) {
                         $jk = array_keys($x[$ik[$i]]);                          $jk = array_keys($x[$ik[$i]]);
Riadok 17 
Riadok 20 
                 return $x;                  return $x;
         } // my_array_walk()          } // my_array_walk()
   
           
         $in = file($input_file);          $in = file($input_file);
         $out = fopen($output_file, "w");  
   
         $i = 0;          $i = 0;
         $j = -1;          $j = -1;
   
         $in_msg_log = false;          $in_msg_log = false;
           $in_add_files = false;
           $in_mod_files = false;
           $in_del_files = false;
   
         while ($i < sizeof($in)) {          while ($i < sizeof($in)) {
                 if (ereg($begin_line, $in[$i])) {                  if (ereg($begin_line, $in[$i])) {
Riadok 34 
Riadok 38 
                 // LOG MESSAGE                  // LOG MESSAGE
                 if ($in_msg_log) {                  if ($in_msg_log) {
                         if (ereg($begin_line, $in[$i])) {                          if (ereg($begin_line, $in[$i])) {
                                 $in_msg_log = 0;                                  $in_msg_log = false;
                                 $i++;                                  $i++;
                                 continue;                                  continue;
                         }                          }
Riadok 45 
Riadok 49 
                         }                          }
                 }                  }
   
                 if (ereg("^Log Message:", $in[$i])) {                  if (ereg('^Log Message:', $in[$i])) {
                         $in_msg_log = 1;                          $in_msg_log = true;
                         $i++;                          $i++;
                         continue;                          continue;
                 }                  }
   
                 // ADDED FILES                  // ADDED FILES
                 if ($in_add_files) {                  if ($in_add_files) {
                         if (!ereg("^(\t|        )", $in[$i])) {                          if (!ereg('^(\t|        )', $in[$i])) {
                                 $in_add_files = 0;                                  $in_add_files = 0;
                                 continue;                                  continue;
                         }                          }
   
                         $reports[$j]['added'] =                          $reports[$j]['added'] =
                                 array_merge($reports[$j]['added'],                                  array_merge($reports[$j]['added'],
                                         explode(" ", trim($in[$i])));                                          explode(' ', trim($in[$i])));
                 }                  }
   
                 if (ereg("^Added Files:", $in[$i])) {                  if (ereg('^Added Files:', $in[$i])) {
                         $in_add_files = 1;                          $in_add_files = 1;
                         $i++;                          $i++;
                         continue;                          continue;
Riadok 71 
Riadok 75 
                                   
                 // MODIFIED FILES                  // MODIFIED FILES
                 if ($in_mod_files) {                  if ($in_mod_files) {
                         if (!ereg("^(\t|        )", $in[$i])) {                          if (!ereg('^(\t|        )', $in[$i])) {
                                 $in_mod_files = 0;                                  $in_mod_files = false;
                                 continue;                                  continue;
                         }                          }
   
                         $reports[$j]['modified'] =                          $reports[$j]['modified'] =
                                 array_merge($reports[$j]['modified'],                                  array_merge($reports[$j]['modified'],
                                 explode(" ", trim($in[$i])));                                  explode(' ', trim($in[$i])));
                 }                  }
   
                 if (ereg("^Modified Files:", $in[$i])) {                  if (ereg('^Modified Files:', $in[$i])) {
                         $in_mod_files = 1;                          $in_mod_files = true;
                         $i++;                          $i++;
                         continue;                          continue;
                 }                  }
                                   
                 // DELETED FILES                  // DELETED FILES
                 if ($in_del_files) {                  if ($in_del_files) {
                         if (!ereg("^(\t|        )", $in[$i])) {                          if (!ereg('^(\t|        )', $in[$i])) {
                                 $in_del_files = 0;                                  $in_del_files = false;
                                 continue;                                  continue;
                         }                          }
   
                         $reports[$j]['deleted'] =                          $reports[$j]['deleted'] =
                                 array_merge($reports[$j]['deleted'],                                  array_merge($reports[$j]['deleted'],
                                         explode(" ", trim($in[$i])));                                          explode(' ', trim($in[$i])));
                 }                  }
   
                 if (ereg("^Removed Files:", $in[$i])) {                  if (ereg('^Removed Files:', $in[$i])) {
                         $in_del_files = 1;                          $in_del_files = true;
                 }                  }
                                   
                 // DATE         //Mon May 20 18:06:09 CEST 2002                  // DATE         //Accepted format: Mon May 20 18:06:09 CEST 2002
                 if (ereg("^([A-Z][a-z]{2} )?([A-Z][a-z]{2} [0-9]+ [0-9]{2}:[0-9]{2}:[0-9]{2})" .                  if (ereg('^([A-Z][a-z]{2} )?([A-Z][a-z]{2} [0-9]+ ' .
                         " CES?T ([0-9]{4})",                          '[0-9]{2}:[0-9]{2}:[0-9]{2}) CES?T ([0-9]{4})',
                         $in[$i], $regs)) {                          $in[$i], $regs)) {
                         $reports[$j]['date'][] = $regs[2] . ' ' . $regs[3];                          $reports[$j]['date'][] = $regs[2] . ' ' . $regs[3];
                 }                  }
   
                 // USERS                  // USERS
                 if (ereg("^CVSUSER=([0-9a-zA-Z]*)", $in[$i], $regs)) {                  if (ereg('^CVSUSER=([0-9a-zA-Z]*)', $in[$i], $regs)) {
                         $reports[$j]['users'][] = $regs[1];                          $reports[$j]['users'][] = $regs[1];
                 }                  }
   
                 // DIRECTORY                  // DIRECTORY
                 if (ereg("^In directory", $in[$i])) {                  if (ereg('^In directory', $in[$i])) {
                         // no a ? ignorujem ! :)                          // This is redundant, simply ignoring it
                 }                  }
   
                 // NAME                  // NAME
                 if (ereg("^Update of /home/cvs/(.*)", $in[$i], $regs)) {                  if (ereg('^Update of /home/cvs/(.*)', $in[$i], $regs)) {
                         // only project name                          // only project name
                         $reports[$j]['name'] = trim(strtok($regs[1], '/'));                          $reports[$j]['name'] = trim(strtok($regs[1], '/'));
                         $reports[$j]['directory'] = trim($regs[1]);                          $reports[$j]['directory'] = trim($regs[1]);
Riadok 133 
Riadok 137 
         $merged = array();          $merged = array();
         $i = 0;          $i = 0;
   
           // Merge recursively all reports into one array
           // eg. join reports with same name
         while ($i < sizeof($reports)) {          while ($i < sizeof($reports)) {
                 unset($a);                  unset($a);
                 $a[$reports[$i]['directory']] = $reports[$i];                  $a[$reports[$i]['directory']] = $reports[$i];
Riadok 140 
Riadok 146 
                 $i++;                  $i++;
         }          }
   
         //var_dump($merged);          $merged_unique = my_array_walk($merged);
   
         //var_dump($reports);          //var_dump($reports);
         $mu = my_array_walk(is_array($merged) ? $merged : array($merged));          //var_dump($merged);
         //var_dump($mu);          //var_dump($merged_unique);
   
           $out = fopen($output_file, 'w');
   
           $keys = array_keys($merged_unique);
         $i = 0;          $i = 0;
         $name = '';          $name = '';
         $keys = array_keys($mu);  
         while ($i < sizeof($mu)) {          // Print out the merged/unique to $out
   
           while ($i < sizeof($merged_unique)) {
                 $k = $keys[$i];                  $k = $keys[$i];
                 $m = $mu[$k];                  $m = $merged_unique[$k];
                 $new_name = is_array($m['name']) ? join(', ', $m['name']) : $m['name'];                  $new_name = is_array($m['name']) ? join(', ', $m['name']) : $m['name'];
                                   
                 if (strcmp($new_name, $name)) {                  if (strcmp($new_name, $name)) {
Riadok 163 
Riadok 175 
                         fwrite($out, "----\n");                          fwrite($out, "----\n");
                 }                  }
   
                 //fwrite($out, "$begin_line\n");                  // DIRECTORY
   
                 // Directory  
                 fwrite($out, 'Path:  ');                  fwrite($out, 'Path:  ');
                 fwrite($out, is_array($m['directory'])                  fwrite($out, is_array($m['directory'])
                         ? join(', ', $m['directory'])                          ? join(', ', $m['directory'])
Riadok 190 
Riadok 200 
                 if (is_array($m['added']) && is_array($m['modified']))                  if (is_array($m['added']) && is_array($m['modified']))
                         $m['modified'] = array_diff($m['modified'], $m['added']);                          $m['modified'] = array_diff($m['modified'], $m['added']);
   
                   // mod = mod - del
                 /*                  /*
                 if (is_array($m['modified']) && is_array($m['deleted']))                  if (is_array($m['modified']) && is_array($m['deleted']))
                         $m['modified'] = array_diff($m['modified'], $m['deleted']);                          $m['modified'] = array_diff($m['modified'], $m['deleted']);
                 */                  */
   
                 $indent_str = str_repeat(' ', strlen('Files') + 2);                  $indent_str = str_repeat(' ', strlen('Files') + 2);
                 if (is_array($m['added']))                  if (is_array($m['added']))
                         fwrite($out, "$indent_str+ "                          fwrite($out, "$indent_str+ "

Legend:
Odstranené z verzie1.10  
zmenené riadky
  Pridané vo verzii1.11

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok