|
|
@ -15,6 +15,7 @@ namespace Composer\Downloader;
|
|
|
|
use Composer\Package\PackageInterface;
|
|
|
|
use Composer\Package\PackageInterface;
|
|
|
|
use Composer\Util\Svn as SvnUtil;
|
|
|
|
use Composer\Util\Svn as SvnUtil;
|
|
|
|
use Composer\Repository\VcsRepository;
|
|
|
|
use Composer\Repository\VcsRepository;
|
|
|
|
|
|
|
|
use Composer\Util\ProcessExecutor;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @author Ben Bieker <mail@ben-bieker.de>
|
|
|
|
* @author Ben Bieker <mail@ben-bieker.de>
|
|
|
@ -171,22 +172,34 @@ class SvnDownloader extends VcsDownloader
|
|
|
|
protected function getCommitLogs($fromReference, $toReference, $path)
|
|
|
|
protected function getCommitLogs($fromReference, $toReference, $path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
|
|
|
|
if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
|
|
|
|
|
|
|
|
// retrieve the svn base url from the checkout folder
|
|
|
|
|
|
|
|
$command = sprintf('svn info %s | grep ^URL:', ProcessExecutor::escape($path));
|
|
|
|
|
|
|
|
if (0 !== $this->process->execute($command, $output, $path)) {
|
|
|
|
|
|
|
|
throw new \RuntimeException(
|
|
|
|
|
|
|
|
'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// parse info line like 'URL: https://example.com/my/svn/url'
|
|
|
|
|
|
|
|
list ($prefix, $baseUrl) = explode(" ", $output, 2);
|
|
|
|
|
|
|
|
|
|
|
|
// strip paths from references and only keep the actual revision
|
|
|
|
// strip paths from references and only keep the actual revision
|
|
|
|
$fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
|
|
|
|
$fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
|
|
|
|
$toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
|
|
|
|
$toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
|
|
|
|
|
|
|
|
|
|
|
|
$command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
|
|
|
|
$command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
|
|
|
|
|
|
|
|
|
|
|
|
if (0 !== $this->process->execute($command, $output, $path)) {
|
|
|
|
$util = new SvnUtil($baseUrl, $this->io, $this->config);
|
|
|
|
|
|
|
|
$util->setCacheCredentials($this->cacheCredentials);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
return $util->executeLocal($command, $path, null, $this->io->isVerbose());
|
|
|
|
|
|
|
|
} catch (\RuntimeException $e) {
|
|
|
|
throw new \RuntimeException(
|
|
|
|
throw new \RuntimeException(
|
|
|
|
'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
|
|
|
|
'Failed to execute ' . $command . "\n\n".$e->getMessage()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$output = "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected function discardChanges($path)
|
|
|
|
protected function discardChanges($path)
|
|
|
|