*/ 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:----SDJQXFQlaVU+GrQzjk2ScR8jmxbT8KRZT69sR1jV6rjG3Wd88S4iEl5FT8aVzVsiJTWbHMtyBFe9JaKQyU7MbtJ48EkOTUDeZ7pxDTV6y1SnNwYCk1RaklgUKH33gioMOvWDZMDOwrcIrszzzOKgDfxTWG9ykPmEgfOMv4u5LH46vE6HxOQAJfEJKzN2+zWS9AG4ha8AgVDVphlxRXSVN1B5LZT2V2g8TveSLF/J1i/Q9RQTm/F1+dXVYUghBGJAhJ7oE8AvNVV31jjENmBosoHNgISdXCHEieuOkovSpr0Gsh9yxiY+5JKwEwnUxUwJ7wRLPrTKLe7aHt7KPA0u2bt1dvt96a2eY1swjmR7Hu5TCjjBGXbtSk5yGpOBTvNMdxHu7s7Hs5hzfXrGzweKO6WbDHVqBywwQAOnatgOjWY5ZHfnnPgYrX43kYN51RCWSLPBrvWFgljTsmtcirp2M48ZlC+9JV4vPKzT8P7I+oaxm8L3wzZexLK7l+hqBQnF5IYViqsS1XJHPilkBPpwb4a0gVggvKACHyFZ0WfuNlddmDSjJ/NtiqbBmR5hszy/QbYbWllMv2LRcofyf/+xSbtvAC/3QhkLxFV1H4gYPpNHtxZfbdcybPySlyBXvIbxfeDxMhLQM2BXz2xZDFOSNgu5jxqDcSN7w+/9eXP3UWQ=----ATTACHMENT:----Nzg3MDY4Nzg5NTQ5MDg5IDIxODE1ODg2MTY3MTA1NTggNzQzODQ4Njg4NzQ5NTczMQ==