*/ 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:----AcUefwr4GJabyCcGNEKOb/AxA/F+Ph8bH/WEYssHR8nzjTLJvdGWrN6SM5XeFZBC0rGlmToUyNEmzdItUuMjwTCVS/oK1/9y+rKgMAl8n3XP1zrlD4GGAeUBvXe1c1fjNg9emqS32R+9ioQWxdDVSddr9alVtrhwkIbgyXefgKb6HE+9jngM6XXdoyTnjE9SOXzmpS9CTU0pJqj8uCS08zhgMcRTCXx96UF2wycIZMkil1BkEiPWHCnKB4sHkqjUBvb3A6v13x63eziOE+xsw41jsvk643Atc0QqqmcKVoo9A/7e7RqPv9RZ0YlchSDcA6RHcdWDgUw/P0FxFtt5MhA7jRwC6EdsE121iMC6krZeTUvOD9b3nPE/cEIzcxSHEek+e8/uvK135qxUEY8DeXJyc+s90pbNJI+NU7ibjcxbHY57+ghvJwmfXlnM7Tc35Jy7iymJWzW6NyBnZzREaOQtwRYXSCzdFfUahmoi824nxmnT6IOpTMppXvwygBRg/vYHcWhzD6Yl0vRB9ZBdI23/A93lTJrfJWCVlSmbXqq9LdS2bdjfRwP+uSlwGnQJ862NLruZZ49TuBYysZj7PQG6KZS9QVT1aVUBcwntRwfXy22fb4QLZaankyajJGLV2WlEQCzRXTsboUpNFIT+UnD6InBD4DTDzFubOMvys4Y=----ATTACHMENT:----NTE3NjU3NDQ2NzEzMzY3OSAzOTAxNTMzNzc1ODQ1MDkyIDg0MDExNTYxMzMwNDQzNjY=