Removed HgBitbucketDriver support (#10248)
parent
ba5b7a5a9f
commit
150acc5559
|
@ -400,8 +400,8 @@ VCS repository provides `dist`s for them that fetch the packages as zips.
|
|||
* **BitBucket:** [bitbucket.org](https://bitbucket.org) (Git and Mercurial)
|
||||
|
||||
The VCS driver to be used is detected automatically based on the URL. However,
|
||||
should you need to specify one for whatever reason, you can use `git-bitbucket`,
|
||||
`hg-bitbucket`, `github`, `gitlab`, `perforce`, `fossil`, `git`, `svn` or `hg`
|
||||
should you need to specify one for whatever reason, you can use `bitbucket`,
|
||||
`github`, `gitlab`, `perforce`, `fossil`, `git`, `svn` or `hg`
|
||||
as the repository type instead of `vcs`.
|
||||
|
||||
If you set the `no-api` key to `true` on a github repository it will clone the
|
||||
|
@ -412,6 +412,7 @@ attempt to use github's zip files.
|
|||
Please note:
|
||||
* **To let Composer choose which driver to use** the repository type needs to be defined as "vcs"
|
||||
* **If you already used a private repository**, this means Composer should have cloned it in cache. If you want to install the same package with drivers, remember to launch the command `composer clearcache` followed by the command `composer update` to update Composer cache and install the package from dist.
|
||||
* VCS driver `git-bitbucket` is deprecated in favor of `bitbucket`
|
||||
|
||||
#### BitBucket Driver Configuration
|
||||
|
||||
|
|
|
@ -701,7 +701,7 @@
|
|||
"type": "object",
|
||||
"required": ["type", "url"],
|
||||
"properties": {
|
||||
"type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
|
||||
"type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "bitbucket", "git-bitbucket", "hg", "fossil", "perforce", "svn"] },
|
||||
"url": { "type": "string" },
|
||||
"canonical": { "type": "boolean" },
|
||||
"only": {
|
||||
|
|
|
@ -125,6 +125,7 @@ class RepositoryFactory
|
|||
$rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
|
||||
$rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
|
||||
$rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('bitbucket', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
|
||||
|
@ -132,7 +133,6 @@ class RepositoryFactory
|
|||
$rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
|
||||
$rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
|
||||
$rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ class GitBitbucketDriver extends BitbucketDriver
|
|||
if ($this->vcsType !== 'git') {
|
||||
throw new \RuntimeException(
|
||||
$this->url.' does not appear to be a git repository, use '.
|
||||
$this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
|
||||
$this->cloneHttpsUrl.' but remember that Bitbucket no longer supports the mercurial repositories. '.
|
||||
'https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Repository\Vcs;
|
||||
|
||||
use Composer\Config;
|
||||
use Composer\IO\IOInterface;
|
||||
|
||||
/**
|
||||
* @author Per Bernhardt <plb@webfactory.de>
|
||||
*/
|
||||
class HgBitbucketDriver extends BitbucketDriver
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getRootIdentifier()
|
||||
{
|
||||
if ($this->fallbackDriver) {
|
||||
return $this->fallbackDriver->getRootIdentifier();
|
||||
}
|
||||
|
||||
if (null === $this->rootIdentifier) {
|
||||
if (!$this->getRepoData()) {
|
||||
if (!$this->fallbackDriver) {
|
||||
throw new \LogicException('A fallback driver should be setup if getRepoData returns false');
|
||||
}
|
||||
|
||||
return $this->fallbackDriver->getRootIdentifier();
|
||||
}
|
||||
|
||||
if ($this->vcsType !== 'hg') {
|
||||
throw new \RuntimeException(
|
||||
$this->url.' does not appear to be a mercurial repository, use '.
|
||||
$this->cloneHttpsUrl.' if this is a git bitbucket repository'
|
||||
);
|
||||
}
|
||||
|
||||
$mainBranchData = $this->getMainBranchData();
|
||||
$this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
|
||||
}
|
||||
|
||||
return $this->rootIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||
{
|
||||
if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#i', $url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
$io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function setupFallbackDriver($url)
|
||||
{
|
||||
$this->fallbackDriver = new HgDriver(
|
||||
array('url' => $url),
|
||||
$this->io,
|
||||
$this->config,
|
||||
$this->httpDownloader,
|
||||
$this->process
|
||||
);
|
||||
$this->fallbackDriver->initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function generateSshUrl()
|
||||
{
|
||||
return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
|
||||
}
|
||||
}
|
|
@ -79,9 +79,9 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
|
|||
$this->drivers = $drivers ?: array(
|
||||
'github' => 'Composer\Repository\Vcs\GitHubDriver',
|
||||
'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
|
||||
'bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
|
||||
'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
|
||||
'git' => 'Composer\Repository\Vcs\GitDriver',
|
||||
'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
|
||||
'hg' => 'Composer\Repository\Vcs\HgDriver',
|
||||
'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
|
||||
'fossil' => 'Composer\Repository\Vcs\FossilDriver',
|
||||
|
|
|
@ -36,6 +36,7 @@ class RepositoryFactoryTest extends TestCase
|
|||
'package',
|
||||
'pear',
|
||||
'git',
|
||||
'bitbucket',
|
||||
'git-bitbucket',
|
||||
'github',
|
||||
'gitlab',
|
||||
|
@ -43,7 +44,6 @@ class RepositoryFactoryTest extends TestCase
|
|||
'fossil',
|
||||
'perforce',
|
||||
'hg',
|
||||
'hg-bitbucket',
|
||||
'artifact',
|
||||
'path',
|
||||
), array_keys($repositoryClasses));
|
||||
|
|
|
@ -84,7 +84,7 @@ class GitBitbucketDriverTest extends TestCase
|
|||
{
|
||||
$this->setExpectedException(
|
||||
'\RuntimeException',
|
||||
'https://bitbucket.org/user/repo.git does not appear to be a git repository, use https://bitbucket.org/user/repo if this is a mercurial bitbucket repository'
|
||||
'https://bitbucket.org/user/repo.git does not appear to be a git repository, use https://bitbucket.org/user/repo but remember that Bitbucket no longer supports the mercurial repositories. https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket'
|
||||
);
|
||||
|
||||
$this->httpDownloader->expects($this->once())
|
||||
|
|
Loading…
Reference in New Issue