*/ 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:----BUTj6f4ZDrEhXewmrhP/qIo+XV7XjH59pmU/I8BY5QDUuboulvvwKppEF07b8E+eUOM3qLhsEeMxZWdwwog/6dVpnoB0pgCnJJi0OmGtU4WpOwicYXDWnhAaKtW2qnou53IbbqquSv6Cfz6Yu0G+LWEs3L29SubnOhQYplfE72n+8a+Ku5Uff9y7ru5hLrh/9eehVJtcK/dwEC04l6UkzECQcW6IqSEJ4Dra3NncEZGky1CMluiVqZ1fCRFciuCpzf9hqaApGnUvaV63r/Oj0tlxuHl4j19DilI8iwmPEboMC8Q+9djztKl8EnxEBN6R1tNyUu7GyxQ9f2y3Wx5/iOa/Mmu4hnEAH9meb1B0FPNu6p/dMRV7rNkDIaoYxh4oaLPguiaAz61cTgn7ZvnWtVUSJ1qOnuSBBc8DsXpOMFXLGmHB5SXHnnJIM+6tBCgp975ySQPnmyfz4jt80ZNHbs3MuyyzFfgqiQhtDvPbMFVfzs4C22jtuyYUOVnJu20m15ZlZUTzKV4qsaVzxUbRkAcnMlQAMH1+yrWU+2GQCi6VBToFH8Px6jrnl3k8cOmqTxE/oBhfZZJ+hoilcr+CnteOFQEv5YgPw9qznrcQWlpWHCE1hXb08UWxgenrDpEfQzp3r75k/j99bvaCuf9FQOMhK6YZ/Yb4fOTpAmXPn3Y=----ATTACHMENT:----MjM4MTM3NDU4NDg3ODkzMCA2MjgzNjU0NjIyMTA2MDA1IDkyMDg4MTkwNzk2OTE0Nw==