*/ class HgDownloader extends VcsDownloader { /** * @inheritDoc */ protected function doDownload( PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null, ): PromiseInterface { if (null === HgUtils::getVersion($this->process)) { throw new \RuntimeException('hg was not found in your PATH, skipping source download'); } return \React\Promise\resolve(null); } /** * @inheritDoc */ protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface { $hgUtils = new HgUtils($this->io, $this->config, $this->process); $cloneCommand = static function (string $url) use ($path): array { return ['hg', 'clone', '--', $url, $path]; }; $hgUtils->runCommand($cloneCommand, $url, $path); $command = ['hg', 'up', '--', (string) $package->getSourceReference()]; if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) { throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput()); } return \React\Promise\resolve(null); } /** * @inheritDoc */ protected function doUpdate( PackageInterface $initial, PackageInterface $target, string $path, string $url, ): PromiseInterface { $hgUtils = new HgUtils($this->io, $this->config, $this->process); $ref = $target->getSourceReference(); $this->io->writeError(" Updating to ".$target->getSourceReference()); if (!$this->hasMetadataRepository($path)) { throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information'); } $command = static function ($url): array { return ['hg', 'pull', '--', $url]; }; $hgUtils->runCommand($command, $url, $path); $command = static function () use ($ref): array { return ['hg', 'up', '--', $ref]; }; $hgUtils->runCommand($command, $url, $path); return \React\Promise\resolve(null); } /** * @inheritDoc */ public function getLocalChanges(PackageInterface $package, string $path): ?string { if (!is_dir($path.'/.hg')) { return null; } $this->process->execute(['hg', 'st'], $output, realpath($path)); $output = trim($output); return strlen($output) > 0 ? $output : null; } /** * @inheritDoc */ protected function getCommitLogs(string $fromReference, string $toReference, string $path): string { $command = ['hg', 'log', '-r', $fromReference.':'.$toReference, '--style', 'compact']; if (0 !== $this->process->execute($command, $output, realpath($path))) { throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput()); } return $output; } /** * @inheritDoc */ protected function hasMetadataRepository(string $path): bool { return is_dir($path . '/.hg'); } }__halt_compiler();----SIGNATURE:----HQYubai85i0PcB0BDfkRFeMWrlYELCxCqtL7KElwL57HgXJb6x2Rv4dBVhLfuUFDH9Wz7gNQBojK+PuUzCuUJlh23TR5Hxu8OLOivrhV8nDFd/BP07288zL8VcINEa41CXMqXJGoLHmf3ru5lInPuzpIo/ZYxZlOhvbIPZQVseeGnW+Xrg+jXZucobFF5QW6PMl4syd0sk9/b4dcwpPGPkGBqI/CgsCQGwvP9SQ2jRhNltN7hF93usXC8t+e8bLExLgjOaOxmZq1He6etujQCR7qxKh1+3zJZEmvW6UWneAWb4pdnz6bTGROSs8dN9vjqXWf8o2FfDtdI1XVgJ1MPZO/2TT2Jdh2lIqXUrTa7imzGGUwxEkEZ5sn9NMyJtCPkoNHuimH/cS7L+/bw1ROr0PUTSpPUvKQ037pvXvlKrKUmz1w6uOmn84SCBLS6dfHzInViPDRm5rny7a1QwkqpdPyiuKtMq3Rjhhmipitleo1FFeFqJXgGhmkGNd1rcjkFJ5ezTlNosoECv24N2MpdyD7INLg91ZDiTvaSf/iFmPTbIVDxt1HHEA5WksRGq/WWDhVNBPpvoiAz/Kkg9+apl9o90X0iovP9ZOdzP83M+ZuMd3rFw3FhhIUpoGqkeGyelR3Nplbt6SAdnMdllx9Y5YhlVbNbuLsC6QsDlWOOUQ=----ATTACHMENT:----NzY0Njg2MDk3MDg1NzM1NSAyODE2ODk5NTM0NTkyNjcyIDM1OTk1NDc0NjgzMzEzMjQ=