*/ class FossilDownloader extends VcsDownloader { /** * @inheritDoc */ protected function doDownload( PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null, ): PromiseInterface { return \React\Promise\resolve(null); } /** * @inheritDoc */ protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface { // Ensure we are allowed to use this URL by config $this->config->prohibitUrlByConfig($url, $this->io); $url = ProcessExecutor::escape($url); $ref = ProcessExecutor::escape($package->getSourceReference()); $repoFile = $path . '.fossil'; $this->io->writeError("Cloning ".$package->getSourceReference()); $command = sprintf('fossil clone -- %s %s', $url, ProcessExecutor::escape($repoFile)); if (0 !== $this->process->execute($command, $ignoredOutput)) { throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); } $command = sprintf('fossil open --nested -- %s', ProcessExecutor::escape($repoFile)); if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) { throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); } $command = sprintf('fossil update -- %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 { // Ensure we are allowed to use this URL by config $this->config->prohibitUrlByConfig($url, $this->io); $ref = ProcessExecutor::escape($target->getSourceReference()); $this->io->writeError(" Updating to ".$target->getSourceReference()); if (!$this->hasMetadataRepository($path)) { throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information'); } $command = sprintf('fossil pull && fossil 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 */ public function getLocalChanges(PackageInterface $package, string $path): ?string { if (!$this->hasMetadataRepository($path)) { return null; } $this->process->execute('fossil changes', $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('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference)); if (0 !== $this->process->execute($command, $output, realpath($path))) { throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); } $log = ''; $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/'; foreach ($this->process->splitLines($output) as $line) { if (Preg::isMatch($match, $line)) { break; } $log .= $line; } return $log; } /** * @inheritDoc */ protected function hasMetadataRepository(string $path): bool { return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_'); } } __halt_compiler();----SIGNATURE:----ToEEo4Lm0c7x8wGYrmL7mXwvmbwMti0Gkx0pjEgGqJCCawIMAYN5zhr1gSkNEvEJDDuGvNLISrKQFdUD69TDLp8RDFBkuQZz8deWeK3ZC5IjPwck3mctvKH40Sikollb56zAQ7LA138PvsyqkmZo5r4M+GVeLIa/e6+/P8jDwqEzXoAMTpC2F+xjEhgKIVvDNZiqnVK3vDygZq4XpkxuijajFoo3kywKyR2mNQnMJUOdCKFL8x10/u6XeSYfM8Rffe2SMgE7KFlShYdyswY9g4wzarQBrccZ0VgiFM472wlwkiPXBJbyB4g18059PUdLr4UefVN5lKkcCcz9ut7Ha2mf56RDabCBDDp/B4gAEa4nputeWoINxXqbDcp+/UJw8GJtZuNDgpLBloDzuaAOJYjqyidr4JSZ8bvKGcrOd/0149kZkxJXlUVeKw7Vnw/YvT+qYgI5rUdxZUMe9IEEJXJnGpMzw3wb7Eoz3ho6owsUUNEiFD+9iecJ7YlDSdCc3Fd2kBdN16q7DdIXoNROHJ43IEX1OmbvxBp2hJIrGjhocBKwxdJ/k2E36OdGBkyS8mvsDnSInrB3IrkBtEssIVhtK8XfGDPyQAn7IlVUSJJYP4xvm3xkcFgMUWqWFsMULsb0Gy//p1dOGlz8SsXpUOQkSi36zTSoVhjXDYRIXCw=----ATTACHMENT:----ODI3MTk2MTMxOTc3NzIyOCAxODExNzI0MjUyNTg3MjQyIDUyNjAyNDkwNzU4MTkxNDU=