Skip to content

Commit

Permalink
Added protection for "svn log ... --use-merge-history ..." command, t…
Browse files Browse the repository at this point in the history
…hat might hand on large merges (bug fix)
  • Loading branch information
aik099 committed Jan 22, 2025
1 parent 3f5646d commit bf8fadf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/SVNBuddy/Repository/Connector/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ private function _doRun($callback = null)
catch ( ProcessTimedOutException $e ) {
// This happens for "svn log --use-merge-history ..." command when we've got all the output already.
if ( $this->_idleTimeoutRecovery && $e->isIdleTimeout() ) {
return $this->getProcessOutput($process);
// TODO: Find a way to avoid hardcoding "</log>".
return $this->getProcessOutput($process) . '</log>';
}

throw $e;
Expand Down
5 changes: 2 additions & 3 deletions tests/SVNBuddy/Repository/Connector/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ public static function runWithoutCachingDataProvider()
public function testRunWithIdleTimeoutRecovery($use_recovery, $timeout_type)
{
$command_line = array('svn', 'log', '--xml');
$process_output = '<log><logentry/></log>';

$this->_command = $this->_createCommand($command_line);

Expand Down Expand Up @@ -164,7 +163,7 @@ public function testRunWithIdleTimeoutRecovery($use_recovery, $timeout_type)
$this->_cacheManager->getCache(Argument::any())->shouldNotBeCalled();

if ( $use_recovery ) {
$this->_process->getOutput()->willReturn($process_output)->shouldBeCalled();
$this->_process->getOutput()->willReturn('<log><logentry/>')->shouldBeCalled();
$this->_io->isVerbose()->willReturn(false)->shouldBeCalled();
$this->_io->isDebug()->willReturn(false)->shouldBeCalled();
}
Expand All @@ -173,7 +172,7 @@ public function testRunWithIdleTimeoutRecovery($use_recovery, $timeout_type)
$this->expectExceptionMessage($process_timed_out_exception->getMessage());
}

$this->assertCommandOutput(null, true, $process_output);
$this->assertCommandOutput(null, true, '<log><logentry/></log>');
}

public static function runWithIdleTimeoutRecoveryDataProvider()
Expand Down

0 comments on commit bf8fadf

Please sign in to comment.