throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
'Can not clone ' . $this->url . ' to access package information. The "' . dirname($this->repoDir)
. '" directory is not writable by the current user.'
);
}
}
if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
throw new \InvalidArgumentException(
throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
'The source URL ' . $this->url . ' is invalid, ssh URLs should have a port number after ":".'
. "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want'
. ' to provide a password or custom port.'
);
}
}
$gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
$gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
$this->io->writeError(
$this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
'<error>Failed to update ' . $this->url . ', package information from this repository'
. ' may be outdated</error>'
);
}
}
$cacheUrl = $this->url;
$cacheUrl = $this->url;
@ -79,10 +68,7 @@ class GitDriver extends VcsDriver
$this->getTags();
$this->getTags();
$this->getBranches();
$this->getBranches();
$this->cache = new Cache(
$this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
@ -356,10 +338,7 @@ class GitLabDriver extends VcsDriver
} catch (\RuntimeException $e) {
} catch (\RuntimeException $e) {
$this->gitDriver = null;
$this->gitDriver = null;
$this->io->writeError(
$this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your credentials</error>');
'<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
. ' so that you can enter your credentials</error>'
);
throw $e;
throw $e;
}
}
}
}
@ -399,7 +378,7 @@ class GitLabDriver extends VcsDriver
switch ($e->getCode()) {
switch ($e->getCode()) {
case 401:
case 401:
case 404:
case 404:
// try to authorize only if we are fetching the main /repos/foo/bar data, otherwise it must be a 404
// try to authorize only if we are fetching the main /repos/foo/bar data, otherwise it must be a real 404
if (!$fetchingRepoData) {
if (!$fetchingRepoData) {
throw $e;
throw $e;
}
}
@ -411,22 +390,13 @@ class GitLabDriver extends VcsDriver
@ -45,10 +45,7 @@ class HgDriver extends VcsDriver
$fs->ensureDirectoryExists($cacheDir);
$fs->ensureDirectoryExists($cacheDir);
if (!is_writable(dirname($this->repoDir))) {
if (!is_writable(dirname($this->repoDir))) {
throw new \RuntimeException(
throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
'Can not clone ' . $this->url . ' to access package information. The "' . $cacheDir
. '" directory is not writable by the current user.'
);
}
}
// Ensure we are allowed to use this URL by config
// Ensure we are allowed to use this URL by config
@ -57,36 +54,20 @@ class HgDriver extends VcsDriver
// update the repo if it is a valid hg repository
// update the repo if it is a valid hg repository
if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
$this->io->writeError(
$this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
'<error>Failed to update ' . $this->url . ', package information from this repository may be'
if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
throw new \RuntimeException(
throw new \RuntimeException('Failed to clone '.$this->url.', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
'Failed to clone ' . $this->url . ', hg was not found, check that it is installed and in'
. ' your PATH env.' . "\n\n" . $this->process->getErrorOutput()
);
}
}
throw new \RuntimeException(
throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
'Failed to clone ' . $this->url . ', could not read packages from it' . "\n\n" .$output
@ -384,10 +381,7 @@ class SvnDriver extends VcsDriver
return $this->util->execute($command, $url);
return $this->util->execute($command, $url);
} catch (\RuntimeException $e) {
} catch (\RuntimeException $e) {
if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
throw new \RuntimeException(
throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
'Failed to load ' . $this->url . ', svn was not found, check that it is installed and in your'