/**
  * Queries missing revision data.
  *
  * @param integer $from_revision From revision.
  * @param integer $to_revision   To revision.
  *
  * @return void
  */
 private function _queryRevisionData($from_revision, $to_revision)
 {
     $range_start = $from_revision;
     // The "io" isn't set during autocomplete.
     if (isset($this->_io)) {
         // Create progress bar for repository plugins, where data amount is known upfront.
         $progress_bar = $this->_io->createProgressBar(ceil(($to_revision - $from_revision) / 200) + 1);
         $progress_bar->setMessage(' * Reading missing revisions:');
         $progress_bar->setFormat('%message% %current%/%max% [%bar%] <info>%percent:3s%%</info> %elapsed:6s%/%estimated:-6s% <info>%memory:-10s%</info>');
         $progress_bar->start();
     }
     $log_command_arguments = $this->_getLogCommandArguments();
     $is_verbose = isset($this->_io) && $this->_io->isVerbose();
     while ($range_start <= $to_revision) {
         $range_end = min($range_start + 199, $to_revision);
         $command = $this->_repositoryConnector->getCommand('log', sprintf($log_command_arguments, $range_start, $range_end, $this->_repositoryRootUrl));
         $command->setCacheDuration('10 years');
         $svn_log = $command->run();
         $this->_parseLog($svn_log);
         $range_start = $range_end + 1;
         if (isset($progress_bar)) {
             $progress_bar->advance();
         }
     }
     if (isset($progress_bar)) {
         // Remove progress bar of repository plugins.
         $progress_bar->clear();
         unset($progress_bar);
         // Create progress bar for database plugins, where data amount isn't known upfront.
         $progress_bar = $this->_io->createProgressBar();
         $progress_bar->setMessage(' * Reading missing revisions:');
         $progress_bar->setFormat('%message% %current% [%bar%] %elapsed:6s% <info>%memory:-10s%</info>');
         $progress_bar->start();
         foreach ($this->getDatabaseCollectorPlugins() as $plugin) {
             $plugin->process($from_revision, $to_revision, $progress_bar);
         }
     } else {
         foreach ($this->getDatabaseCollectorPlugins() as $plugin) {
             $plugin->process($from_revision, $to_revision);
         }
     }
     if (isset($progress_bar)) {
         $progress_bar->finish();
         $this->_io->writeln('');
     }
     if ($is_verbose) {
         $this->_displayPluginActivityStatistics();
     }
 }
Exemple #2
0
 /**
  * Queries missing revision data.
  *
  * @param integer $from_revision From revision.
  * @param integer $to_revision   To revision.
  *
  * @return void
  */
 private function _queryRevisionData($from_revision, $to_revision)
 {
     $range_start = $from_revision;
     $project_url = $this->_repositoryConnector->getProjectUrl($this->_repositoryUrl);
     $progress_bar = $this->_io->createProgressBar(ceil(($to_revision - $from_revision) / 1000));
     $progress_bar->setFormat(' * Reading missing revisions: %current%/%max% [%bar%] %percent:3s%%');
     $progress_bar->start();
     while ($range_start < $to_revision) {
         $range_end = min($range_start + 1000, $to_revision);
         $command = $this->_repositoryConnector->getCommand('log', '-r ' . $range_start . ':' . $range_end . ' --xml --verbose --use-merge-history {' . $project_url . '}');
         $this->_parseLog($command->run());
         $range_start = $range_end + 1;
         $progress_bar->advance();
     }
     $progress_bar->finish();
     $this->_io->writeln('');
 }
Exemple #3
0
 /**
  * @dataProvider commandWithParamsDataProvider
  */
 public function testCommandWithParams($params, $expected_command)
 {
     $this->_expectCommand($expected_command, 'OK');
     $this->assertEquals('OK', $this->_repositoryConnector->getCommand('log', $params)->run());
 }