Merge remote-tracking branch 'jimmykane/master'
commit
a1e4ca4f9b
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
use Composer\Composer;
|
use Composer\Composer;
|
||||||
|
use Composer\Factory;
|
||||||
use Composer\Util\RemoteFilesystem;
|
use Composer\Util\RemoteFilesystem;
|
||||||
use Composer\Downloader\FilesystemException;
|
use Composer\Downloader\FilesystemException;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -42,12 +43,18 @@ EOT
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
$config = Factory::createConfig();
|
||||||
|
$cacheDir = $config->get('cache-dir');
|
||||||
|
|
||||||
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
|
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
|
||||||
$tempFilename = dirname($localFilename) . '/' . basename($localFilename, '.phar').'-temp.phar';
|
|
||||||
|
// Check if current dir is writable and if not try the cache dir from settings
|
||||||
|
$tmpDir = is_writable(dirname($localFilename))? dirname($localFilename) : $cacheDir;
|
||||||
|
$tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
|
||||||
|
|
||||||
// check for permissions in local filesystem before start connection process
|
// check for permissions in local filesystem before start connection process
|
||||||
if (!is_writable($tempDirectory = dirname($tempFilename))) {
|
if (!is_writable($tmpDir)) {
|
||||||
throw new FilesystemException('Composer update failed: the "'.$tempDirectory.'" directory used to download the temp file could not be written');
|
throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable($localFilename)) {
|
if (!is_writable($localFilename)) {
|
||||||
|
|
|
@ -49,14 +49,14 @@ 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 -u', $output, $this->repoDir)) {
|
if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
|
||||||
$this->io->write('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
|
$this->io->write('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// clean up directory and do a fresh clone into it
|
// clean up directory and do a fresh clone into it
|
||||||
$fs->removeDirectory($this->repoDir);
|
$fs->removeDirectory($this->repoDir);
|
||||||
|
|
||||||
if (0 !== $this->process->execute(sprintf('hg clone %s %s', escapeshellarg($this->url), escapeshellarg($this->repoDir)), $output, $cacheDir)) {
|
if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', escapeshellarg($this->url), escapeshellarg($this->repoDir)), $output, $cacheDir)) {
|
||||||
$output = $this->process->getErrorOutput();
|
$output = $this->process->getErrorOutput();
|
||||||
|
|
||||||
if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
|
if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
|
||||||
|
|
Loading…
Reference in New Issue