*/ 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:----UwWUgr+FN1YNnC3NUuAYSoBzY54M+rcwljO+84VEIyBkvRHbVTJM0kpVXoY0LcL/m8YMtcfWAvKpTUS2A2mDZITz3rdO14HPOg97yIXnu5MGpBCN204Odt2XZh9uFfMnnhByB+A9yfz6YW3w4cIbtglWTxtKw+fn9XzYI0V96QmzyXBv2f0tlUqmevgNER0+TtGPQGISh8nyDnOPWRaz/6DJxdElSNyxPgPV/qQ9cVhdGScOg0cWOwLsTxnrig+sPf8BYIkwv7SoGaaC8BPny8FwRxRgbLIMxaFHlB+u0uw9LAlP/lpUlxBuS9/+RS+gV3tbbeQOL1/r8xqA+2pQ9h/H7SFwm81vbXvPOd6J52RETZloRXlvlwObNKFRKcH6yA7noVc1dCyP8BDxcozNpKYCXulxQZLl5jVQ/nifm5Lh6V2kfFIfKlENAI5mVlFkbCwoUpKO6dQV9cQZf6TC2Hou6/HhVHhN/gxf+oXbeaG/oCAYXXQSzS/qx9htHMc3U6q8su4u5woZ5Sgukpd/JUNT/MxjC8FMB63TKEAFJT6ymGyuG0W38wNLqWBhdmOVvzZ4VesxqZ37rzQ21J/s6OnH3Bjfp4bQcyuKvdnFC3watYn3J9Zo40M2VkBHsT4+txw65ytR4LoCr+2cxc4aSWBqW4E0LyGWU8dXwU7zloM=----ATTACHMENT:----Nzk1NjE1NjQ2Mjg2Mjc3NSA0MTI3OTM4MzM0MDA3MjQwIDc5Nzk3MDU1MjkyNTYzNzE=