1
0
Fork 0

Show proper error message when a git bitbucket repo is loaded as hg repo, refs composer/packagist#294

pull/1624/head
Jordi Boggiano 2013-02-27 10:54:19 +01:00
parent 7f861d0c07
commit 15e9c3d101
1 changed files with 3 additions and 0 deletions

View File

@ -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'];
}