*/ 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): string { return sprintf('hg clone -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path)); }; $hgUtils->runCommand($cloneCommand, $url, $path); $ref = ProcessExecutor::escape($package->getSourceReference()); $command = sprintf('hg up -- %s', $ref); if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) { throw new \RuntimeException('Failed to execute ' . $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) use ($ref): string { return sprintf('hg pull -- %s && hg up -- %s', ProcessExecutor::escape($url), ProcessExecutor::escape($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 = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference)); if (0 !== $this->process->execute($command, $output, realpath($path))) { throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); } return $output; } /** * @inheritDoc */ protected function hasMetadataRepository(string $path): bool { return is_dir($path . '/.hg'); } } __halt_compiler();----SIGNATURE:----gcTU7iCE0dMZpisDnvlDyCyUsTVbeElPiHvZdyZjXdLdllazlCPW3vmST0C0wgUPT2v7IMcUHcZ/VSiFTtlQFGy80hTSrzsiDbQRvIR4pyDiKXZE+3kboLuy3tPECJhM3x+I+JRgWJOMlnub/XHg0a1qqWqEAvn1RmEnQ7deR/QVG12VKRI3BU/H/4B44G5Ft3RivVbnLVLskrY0Nnp893TmNr26ZkVwmhjA0BrN3RZjtR02Y6oDl4l4fbv6sWuZVm4ro3LPmG6ycNEmcEsrmCBBqKLvsMQkc4SmMT0jndPjU8FZG13li9h4BnSOTBq218Ns6bIhP5PzARdGsmm9GJwNX0jYI3Sy4/HfXu7WqxJnMCvufXyuWwDXdtaUTwR2YIJq6WjCZu0A6f+1xsK4Spse+CL9McOj2kC9hYILzRnjPsjbi4lt9bQLS79xfM6izEqU5oz6G6vJz2/wd/l2ciRHC04TEo4aXCejGaIbl/r/4AAC1ALAM++Bk7Q4pB44a7TWEdrSEYeKOFxLFuMrx3sQ8ns4WC0OaXkN5aQiIp8mYGW+oFDKk7Rld17/sZKCbuGVAr0cl//7TjnVOWMPEhR9ow9mIt/jzxWAB8eUNSj6UGWzUBuMsKPilPEHYnGq9oSS2d4HiKGBEieDQTe7ab7U3PEPGJmb9I8V0z1sqvk=----ATTACHMENT:----NDI5Mzc4MDIzOTEyNTg1MyA2Nzg0MjcxNjY5MDQ4Njg5IDEwNTU1NTQzMTMwODc2NDY=