Skip to content

Commit bf8fadf

Browse files
committed
Added protection for "svn log ... --use-merge-history ..." command, that might hand on large merges (bug fix)
1 parent 3f5646d commit bf8fadf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/SVNBuddy/Repository/Connector/Command.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ private function _doRun($callback = null)
264264
catch ( ProcessTimedOutException $e ) {
265265
// This happens for "svn log --use-merge-history ..." command when we've got all the output already.
266266
if ( $this->_idleTimeoutRecovery && $e->isIdleTimeout() ) {
267-
return $this->getProcessOutput($process);
267+
// TODO: Find a way to avoid hardcoding "</log>".
268+
return $this->getProcessOutput($process) . '</log>';
268269
}
269270

270271
throw $e;

tests/SVNBuddy/Repository/Connector/CommandTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ public static function runWithoutCachingDataProvider()
133133
public function testRunWithIdleTimeoutRecovery($use_recovery, $timeout_type)
134134
{
135135
$command_line = array('svn', 'log', '--xml');
136-
$process_output = '<log><logentry/></log>';
137136

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

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

166165
if ( $use_recovery ) {
167-
$this->_process->getOutput()->willReturn($process_output)->shouldBeCalled();
166+
$this->_process->getOutput()->willReturn('<log><logentry/>')->shouldBeCalled();
168167
$this->_io->isVerbose()->willReturn(false)->shouldBeCalled();
169168
$this->_io->isDebug()->willReturn(false)->shouldBeCalled();
170169
}
@@ -173,7 +172,7 @@ public function testRunWithIdleTimeoutRecovery($use_recovery, $timeout_type)
173172
$this->expectExceptionMessage($process_timed_out_exception->getMessage());
174173
}
175174

176-
$this->assertCommandOutput(null, true, $process_output);
175+
$this->assertCommandOutput(null, true, '<log><logentry/></log>');
177176
}
178177

179178
public static function runWithIdleTimeoutRecoveryDataProvider()

0 commit comments

Comments
 (0)