Permalink
Browse files

Fix picking of new dev packages for updates to latest source ref

  • Loading branch information...
1 parent f9f86f0 commit c97720c6074bc13fabfbbe7f2a1b8c11d063f303 @Seldaek Seldaek committed Aug 24, 2012
Showing with 26 additions and 7 deletions.
  1. +12 −3 src/Composer/Installer.php
  2. +14 −4 tests/Composer/Test/Fixtures/installer/update-alias-lock.test
View
15 src/Composer/Installer.php
@@ -247,7 +247,8 @@ protected function doInstall($localRepo, $installedRepo, $aliases, $devMode = fa
// creating repository pool
$pool = new Pool($minimumStability, $stabilityFlags);
$pool->addRepository($installedRepo, $aliases);
- foreach ($this->repositoryManager->getRepositories() as $repository) {
+ $repositories = $this->repositoryManager->getRepositories();
+ foreach ($repositories as $repository) {
$pool->addRepository($repository, $aliases);
}
@@ -360,6 +361,10 @@ protected function doInstall($localRepo, $installedRepo, $aliases, $devMode = fa
continue;
}
+ if ($package instanceof AliasPackage) {
+ continue;
+ }
+
// skip packages that will be updated/uninstalled
foreach ($operations as $operation) {
if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
@@ -394,9 +399,13 @@ protected function doInstall($localRepo, $installedRepo, $aliases, $devMode = fa
$newPackage = null;
$matches = $pool->whatProvides($package->getName(), new VersionConstraint('=', $package->getVersion()));
foreach ($matches as $match) {
- if (null === $newPackage || $newPackage->getReleaseDate() < $match->getReleaseDate()) {
- $newPackage = $match;
+ // skip local packages
+ if (!in_array($match->getRepository(), $repositories, true)) {
+ continue;
}
+
+ $newPackage = $match;
+ break;
}
if ($newPackage && $newPackage->getSourceReference() !== $package->getSourceReference()) {
View
18 tests/Composer/Test/Fixtures/installer/update-alias-lock.test
@@ -1,5 +1,5 @@
--TEST--
-Update aliased package to non-aliased version
+Update aliased package does not mess up the lock file
--COMPOSER--
{
"repositories": [
@@ -12,12 +12,22 @@ Update aliased package to non-aliased version
"source": { "reference": "master", "type": "git", "url": "" }
}
]
+ },
+ {
+ "type": "package",
+ "package": [
+ {
+ "name": "a/a", "version": "dev-master",
+ "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
+ "source": { "reference": "lowpriomaster", "type": "git", "url": "" }
+ }
+ ]
}
],
"require": {
"a/a": "1.*"
},
- "minimum-stability": "stable"
+ "minimum-stability": "dev"
}
--LOCK--
{
@@ -27,7 +37,7 @@ Update aliased package to non-aliased version
],
"packages-dev": null,
"aliases": [],
- "minimum-stability": "stable",
+ "minimum-stability": "dev",
"stability-flags": []
}
--INSTALLED--
@@ -48,7 +58,7 @@ update
],
"packages-dev": null,
"aliases": [],
- "minimum-stability": "stable",
+ "minimum-stability": "dev",
"stability-flags": []
}
--EXPECT--

0 comments on commit c97720c

Please sign in to comment.