From 15e9c3d101001ef00e5ce7172ae430f2cbb06deb Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 27 Feb 2013 10:54:19 +0100 Subject: [PATCH] Show proper error message when a git bitbucket repo is loaded as hg repo, refs composer/packagist#294 --- src/Composer/Repository/Vcs/HgBitbucketDriver.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Composer/Repository/Vcs/HgBitbucketDriver.php b/src/Composer/Repository/Vcs/HgBitbucketDriver.php index f31f61c44..37a8f0d90 100644 --- a/src/Composer/Repository/Vcs/HgBitbucketDriver.php +++ b/src/Composer/Repository/Vcs/HgBitbucketDriver.php @@ -46,6 +46,9 @@ class HgBitbucketDriver extends VcsDriver if (null === $this->rootIdentifier) { $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags'; $repoData = JsonFile::parseJson($this->getContents($resource), $resource); + if (array() === $repoData) { + throw new \RuntimeException('This does not appear to be a mercurial repository, use '.$this->url.'.git if this is a git bitbucket repository'); + } $this->rootIdentifier = $repoData['tip']['raw_node']; }