*/ 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:----uUgF0S7AoH+77a4pPlyj57caztg4NRtfipxmMFduVx1esqtIsVZind1zh0lT4s4B0gwYoGCXnMkCfqa3u+D91kf4zjIBBgiMcVoyk3SW9e1hl+w58L8CgqNZYFRCmqM2VD5Jj9aUTTlYIJoS9uCxBsCq7NAozgigsnq2fncJ5kIWLqUWP+HNJyEH415KZtsMDr2buQYcxJyNeB8XtQQRzFkqrZrNWL9LmWMuuZTXrqzgzveI24R77mr7rqwdAmz+Xiqg4Gu5GKPrs7fK8Zb0OnZLbW1TwnhMIFU7UdraEQK3c3NnPaH9RCHkXomIaOGQt2Yb6dqtJjfzgzDykmLr+n9jevXjZ/Pcfk3Xz3av7QXgkh64hqbQJyZYMhLh5ZLRnpgsOnZmS8Vka+xDAcgEtvnt33wbvZNDL+G+Vpcuzk6Fxl8019zko7UAkkzOVzz5Wa4Ri4kuz3QETPrece6xUPViJLci12aFWa2XWd/3NkoXQ6/9yWmgK6IV+qMgbv5e8khaw7aYHtxAhlxK8lp+dufcDJWvcBLqQNbNb+cTuywhk0VwUPy52v+jPTwwnzMGm4dj8SwfoKUhOObjuae3RODLI+icbwgFtb1WOZbyRcYxB+avgkJFl124mRV7FpTzf0j7HGaCnfHpahaKfPuEnfQnxjEbwtL5b8pXqOK4Vqs=----ATTACHMENT:----Mjk4OTEyODIwMzQ4Nzg0MyA0NDE0Njk5MjQ0Njg4NzUzIDg4NTMyODYxNzY5NTYzMzU=