Prechádzať zdrojové kódy

hg repos must not be hosted somewhere in particular, but detection may become expensive.

Additionally, suppress warnings and support file://-local repos
Matthias Pigulla 13 rokov pred
rodič
commit
2fc8e06d81

+ 5 - 10
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) {
-            return false;
-        }
-
-        exec(sprintf('hg identify %s', escapeshellarg($url)), $output);
+	    if ($deep) {
+		    exec(sprintf('hg identify %s', escapeshellarg($url)), $outputIgnored, $exit);
+		    return $exit == 0;
+	    }
 
-        return (boolean)$output;
+	    return false;
     }
 }

+ 4 - 4
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;
     }
 }