// update the repo if it is a valid git repository
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)) {
$this->io->write('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
}
} else {
$dir = dirname($this->tmpDir);
// 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.', could not read packages from it' . "\n\n" .$output);
}
}
}
$this->getTags();
@ -52,9 +74,8 @@ class HgDriver extends VcsDriver
*/
public function getRootIdentifier()
{
$tmpDir = escapeshellarg($this->tmpDir);
if (null === $this->rootIdentifier) {
$this->process->execute(sprintf('cd %s &&hg tip --template "{node}"', $tmpDir), $output);
$this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
$output = $this->process->splitLines($output);
$this->rootIdentifier = $output[0];
}
@ -94,7 +115,7 @@ class HgDriver extends VcsDriver
public function getComposerInformation($identifier)