1
0
Fork 0

Merge branch '1.2'

pull/5918/merge
Jordi Boggiano 2016-12-01 00:00:32 +01:00
commit 193d53921b
3 changed files with 95 additions and 47 deletions

View File

@ -10,6 +10,11 @@
* Removed `hash` from composer.lock, only `content-hash` is now used which should reduce conflicts
* Minor fixes and performance improvements
### [1.2.3] - 2016-12-01
* Fixed bug in HgDriver failing to identify BitBucket repositories
* Fixed support for loading partial provider repositories
### [1.2.2] - 2016-11-03
* Fixed selection of packages based on stability to be independent from package repository order
@ -453,7 +458,8 @@
* Initial release
[1.3.0-RC]: https://github.com/composer/composer/compare/1.2.2...1.3.0-RC
[1.3.0-RC]: https://github.com/composer/composer/compare/1.2.3...1.3.0-RC
[1.2.3]: https://github.com/composer/composer/compare/1.2.2...1.2.3
[1.2.2]: https://github.com/composer/composer/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/composer/composer/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/composer/composer/compare/1.2.0-RC...1.2.0

View File

@ -284,8 +284,13 @@ 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,
<<<<<<< HEAD
should you need to specify one for whatever reason, you can use `fossil`,
`git`, `svn` or `hg` as the repository type instead of `vcs`.
=======
should you need to specify one for whatever reason, you can use `fossil`, `git`,
`svn` or `hg` as the repository type instead of `vcs`.
>>>>>>> 1.2
If you set the `no-api` key to `true` on a github repository it will clone the
repository as it would with any other git repository instead of using the
@ -662,7 +667,7 @@ You can disable the default Packagist repository by adding this to your
{
"repositories": [
{
"packagist": false
"packagist.org": false
}
]
}

View File

@ -59,6 +59,8 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
protected $distMirrors;
private $degradedMode = false;
private $rootData;
private $hasPartialPackages;
private $partialPackagesByName;
public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
{
@ -280,6 +282,11 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
return $this->providers[$name];
}
if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
$this->initializePartialPackages();
}
if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
// skip platform packages, root package and composer-plugin-api
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
return array();
@ -340,9 +347,19 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
}
}
$loadingPartialPackage = false;
} else {
$packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
$loadingPartialPackage = true;
}
$this->providers[$name] = array();
foreach ($packages['packages'] as $versions) {
foreach ($versions as $version) {
if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
continue;
}
// avoid loading the same objects twice
if (isset($this->providersByUid[$version['uid']])) {
// skip if already assigned
@ -492,6 +509,8 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
if (!empty($data['providers-lazy-url'])) {
$this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
$this->hasProviders = true;
$this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
}
if ($this->allowSslDowngrade) {
@ -754,4 +773,22 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
}
}
}
/**
* This initializes the packages key of a partial packages.json that contain some packages inlined + a providers-lazy-url
*
* This should only be called once
*/
private function initializePartialPackages()
{
$rootData = $this->loadRootServerFile();
$this->partialPackagesByName = array();
foreach ($rootData['packages'] as $package => $versions) {
$this->partialPackagesByName[strtolower($package)] = $versions;
}
// wipe rootData as it is fully consumed at this point and this saves some memory
$this->rootData = true;
}
}