*/ 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:----MBieCaKwho/l09qk47JP0cL56HqUApFItfiKAQ8Z0PXnJ+q1Hylm4UVRfxIIHtqWeTR5i1td6CfgDmZUJQEVJd871o3UtcVoo3sRr3CSH8PpI5hNA/79tpQUl1ZPYfN4tA6HQwcs66vkcdWaleNPOc/G3vpBlJ67kIA5962Bc67VqMEP+J889Yw51AttUgHdaOLL/0XDwf6H83SPU/932crEK5LXaFRC1Kup94u9GAde51BayyZtRAph07KmGECCy6ibNka7lGgZkx+AMWaYYzdS/uY6JOkiPxvY22EPwadBJTeeQyYMA+p1khwNVI8rfl+xnoFB8GehW/tazoweK88KMZ48WhjHFAdfZo7WJb047dwYBA1/BNblxZPposdrAzNESsEBAkA+ufZcSoMZV/edVFj6DaRkgnxpHbfINOpkl+oRd2WaDSxONwvmc1CrkfgtDCEIBGM3a0tG/3rctAQiPxGgWNApNe1yf1/+rBgTNLb6eegX6yeDfCHZJjZECB5uVpyePFMVwl4rfgEq2Nt5kZ8Y9+VxutQn4Bx6uyDNO8LcuJMkgst+mljAr5jwQBeSO+mS1Riu+ihYGxnoHWc4k8NGl2vPISqNGulcVgdna5j/iCpiGI9RG3GYDkzIkXrHTPhDEOOvuYjBf/3cNtdcfSIA7xtM1e4Qzt7BZiY=----ATTACHMENT:----NjgwODExMTk2NzQyNjEwMCA0MzU2Mzg0NzE1NzE1MDM0IDI2NjI2MzEwNTYzOTkwMw==