'Can not clone ' . $this->url . ' to access package information. The "' . dirname($this->repoDir)
. '" directory is not writable by the current user.'
);
throw new \RuntimeException('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)) {
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.'
);
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.');
}
$gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
$this->io->writeError(
'<error>Failed to update ' . $this->url . ', package information from this repository'
. ' may be outdated</error>'
);
$this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
}
$cacheUrl = $this->url;
@ -79,10 +68,7 @@ class GitDriver extends VcsDriver
if (!ctype_alnum($character)) $character = '%' . sprintf('%02X', ord($character));
$encoded .= $character;
}
return $encoded;
@ -356,10 +338,7 @@ class GitLabDriver extends VcsDriver
} catch (\RuntimeException $e) {
$this->gitDriver = null;
$this->io->writeError(
'<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
. ' so that you can enter your credentials</error>'
);
$this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your credentials</error>');
throw $e;
}
}
@ -399,7 +378,7 @@ class GitLabDriver extends VcsDriver
switch ($e->getCode()) {
case 401:
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) {
throw $e;
}
@ -411,22 +390,13 @@ class GitLabDriver extends VcsDriver
if (!$this->io->isInteractive()) {
return $this->attemptCloneFallback();
}
$this->io->writeError(
'<warning>Failed to download ' . $this->owner . '/' . $this->repository
. ':' . $e->getMessage() . '</warning>'
);
$gitLabUtil->authorizeOAuthInteractively(
$this->scheme,
$this->originUrl,
'Your credentials are required to fetch private repository metadata (<info>'
@ -45,10 +45,7 @@ class HgDriver extends VcsDriver
$fs->ensureDirectoryExists($cacheDir);
if (!is_writable(dirname($this->repoDir))) {
throw new \RuntimeException(
'Can not clone ' . $this->url . ' to access package information. The "' . $cacheDir
. '" directory is not writable by the current user.'
);
throw new \RuntimeException('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
@ -57,36 +54,20 @@ class HgDriver extends VcsDriver
// 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 (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
$this->io->writeError(
'<error>Failed to update ' . $this->url . ', package information from this repository may be'
$this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
}
} else {
// clean up directory and do a fresh clone into it
if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
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()
);
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());
}
throw new \RuntimeException(
'Failed to clone ' . $this->url . ', could not read packages from it' . "\n\n" .$output
);
throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
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());