function HgDriver::supports
@inheritDoc
Overrides VcsDriverInterface::supports
File
-
vendor/
composer/ composer/ src/ Composer/ Repository/ Vcs/ HgDriver.php, line 213
Class
- HgDriver
- @author Per Bernhardt <plb@webfactory.de>
Namespace
Composer\Repository\VcsCode
public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false) : bool {
if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\\.kilnhg.com)#i', $url)) {
return true;
}
// local filesystem
if (Filesystem::isLocalPath($url)) {
$url = Filesystem::getPlatformPath($url);
if (!is_dir($url)) {
return false;
}
$process = new ProcessExecutor($io);
// check whether there is a hg repo in that path
if ($process->execute([
'hg',
'summary',
], $output, $url) === 0) {
return true;
}
}
if (!$deep) {
return false;
}
$process = new ProcessExecutor($io);
$exit = $process->execute([
'hg',
'identify',
'--',
$url,
], $ignored);
return $exit === 0;
}