*/ class Hg { /** @var string|false|null */ private static $version = false; /** @var \Composer\IO\IOInterface */ private $io; /** @var \Composer\Config */ private $config; /** @var \Composer\Util\ProcessExecutor */ private $process; public function __construct(IOInterface $io, Config $config, ProcessExecutor $process) { $this->io = $io; $this->config = $config; $this->process = $process; } public function runCommand(callable $commandCallable, string $url, ?string $cwd): void { $this->config->prohibitUrlByConfig($url, $this->io); // Try as is $command = $commandCallable($url); if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) { return; } // Try with the authentication information available if (Preg::isMatch('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication((string) $match[5])) { $auth = $this->io->getAuthentication((string) $match[5]); $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . $match[6]; $command = $commandCallable($authenticatedUrl); if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) { return; } $error = $this->process->getErrorOutput(); } else { $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)'; } $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url); } /** * @param non-empty-string $message * * @return never */ private function throwException($message, string $url): void { if (null === self::getVersion($this->process)) { throw new \RuntimeException(Url::sanitize('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput())); } throw new \RuntimeException(Url::sanitize($message)); } /** * Retrieves the current hg version. * * @return string|null The hg version number, if present. */ public static function getVersion(ProcessExecutor $process): ?string { if (false === self::$version) { self::$version = null; if (0 === $process->execute('hg --version', $output) && Preg::isMatch('/^.+? (\d+(?:\.\d+)+)(?:\+.*?)?\)?\r?\n/', $output, $matches)) { self::$version = $matches[1]; } } return self::$version; } } __halt_compiler();----SIGNATURE:----mcv/+H9WZZqELUuOcEALwgt/0/WjauVaPCyAhIh9BuRlNgAvwpD1RF79dIY2hAE4ywHUYpzIrFLx10uWwtCJnLSmP9VHFHl49WzEzk5hgfmSVPY6fg+2MAIOnuzcdzLFJmJ4SnM8YjfY94e2G4tFt5nre1i9mDeXnpiow4mjUSxWzhYlIq8f4RZ/Pvrnd4xixSoIe8mw0tMUJeggLqu9JfKJeEzFQg2IkYlflhfxZbfsub0QvY3o5Lb5TKPgXTau+1e24LzQLJRArF01aF2MCnXIgp6T/szWAfs2Ql1Oqs7FV0g6EsVssL2VkYf7zV6SuaWWs3eoG9Pv3moxXhAIOPB9RYMAIi7czVBqG15qytmGS68aeDuuG3lYCJr9x8cChXM5XiceL+uLuvEGd1Wev6UR3e/1JwO8Gy4zyOrYbs4AWFb2LSwfNgywgrB/lzfyjLS/gEWlB2L9YgsdV6Y7dO6YeVmgobjrOIU7ecx9BZ4mpVFR/QJCk6fQ9Bo9evW9aZZJddCtn4YLbrbuCIyPxkjfUfZVXRM9OAlADOXYaHf79W25F1o9MieKYSqZ3ahiH+EBJ56OF41hLGXpN3aWa8jsvlfIgEfuOrNrRM7VnNJ9tbqYddK98ffZjOgOfcIYkXdFtYKV0YdMiA+t3z+dgkfyASbK5AdfdPmCjrxOx/Q=----ATTACHMENT:----NTYzMzYzMDMzOTcwNTA5NSA3OTY2NjIzMTE5ODU4MzQyIDk3OTkzMTg5NjIwNjc5MzQ=