From 2fc8e06d816c927db4df212b690051c026dfa127 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Fri, 9 Dec 2011 23:10:31 +0100 Subject: [PATCH] hg repos must not be hosted somewhere in particular, but detection may become expensive. Additionally, suppress warnings and support file://-local repos --- src/Composer/Repository/Vcs/HgDriver.php | 15 +++++---------- src/Composer/Repository/Vcs/SvnDriver.php | 8 ++++---- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/Composer/Repository/Vcs/HgDriver.php b/src/Composer/Repository/Vcs/HgDriver.php index 29af3199b..b51dcaf52 100644 --- a/src/Composer/Repository/Vcs/HgDriver.php +++ b/src/Composer/Repository/Vcs/HgDriver.php @@ -172,16 +172,11 @@ class HgDriver implements VcsDriverInterface */ public static function supports($url, $deep = false) { - if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) { - return true; - } + if ($deep) { + exec(sprintf('hg identify %s', escapeshellarg($url)), $outputIgnored, $exit); + return $exit == 0; + } - if (!$deep) { - return false; - } - - exec(sprintf('hg identify %s', escapeshellarg($url)), $output); - - return (boolean)$output; + return false; } } diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index a1574b6b8..23ec54e81 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -174,11 +174,11 @@ class SvnDriver implements VcsDriverInterface return true; } - if (!$deep) { - return false; + if ($deep) { + @exec(sprintf('svn info --non-interactive %s 2>/dev/null', escapeshellarg($url)), $outputIgnored, $exit); + return $exit == 0; } - exec(sprintf('svn info --non-interactive %s', escapeshellarg($url)), $output); - return preg_match('{^Repository UUID:}m', implode("\n", $output)) >= 1; + return false; } }