*/ 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:----p6Lprb0jx3Q2BmshwGG+T0B4q9aQ+6HVm5by/OWT8QAlO4FC3QKnIjA/iZSyJNMqa7GIK7vmATlZW+FM6QkYroiPjsG5rLNLYnpYTcJOp1muOPuV+XzopHnbuFwvDQqiJfv/bs1G72nYrfHF12IuGtaNJB/YB2kRFND4sUDtVg2IKWBzfcw7P+L4CIFgbS71C8UbyeP6/F0pLRscTy8FuCltZgERxdkDDCAM4pxmOSJqPPITg86/I8L7wPaDKEmbq8/0h8Pv8DJ2BXK//+Hk9uad7LTwyNnN7wsuFzCfJCaoheICOqIv50OsiV+CdvsSe7Tk1STToePFk6+blRtpDte0RQBoi5AkwekyjlRvPcd+lQcjWbtobTS4vZnM9n7ra6urtlJx1CkHVMST2s/mKt6oyOs9f1pJ2RayaBnpC+J6x3Skc4XQA0vMj2y4BAVkyP7ka96tLX0Ph5ci7JBD141zh9XNt5NZc6HZO0JQoKf3ICobkmL10cAcio3H6tb/Heimi2ejCWfNnbP3UhaPFvUZC+76smW58mH7q9KurAPp89tMYV4KZnrVY0Fh+p8auy2SqmcpxcuUWEnvl0EUmgNoTHZXeYIUubk+78hbQzv2MJBXrfJdiQvK+ryZaTHkPTZd1h3INQXWkFWLYiWNBcRZPJTnQ3nfCoUCgCyTNic=----ATTACHMENT:----NDc0MjM4MDYyMDM2MTEwOCA0OTU0ODcyMjgwOTE4MDMwIDM4MDc3MTA0OTg0NjczNDQ=