From 88b018068cdcde719489a4e59d0bb223ee88f4d4 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 19 Feb 2012 00:51:13 +0100 Subject: [PATCH] Force dev packages to update to latest ref on update --- src/Composer/Command/InstallCommand.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php index 86552362b..e2dcb6a38 100644 --- a/src/Composer/Command/InstallCommand.php +++ b/src/Composer/Command/InstallCommand.php @@ -30,6 +30,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Composer\DependencyResolver\Operation\InstallOperation; +use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Solver; use Composer\IO\IOInterface; @@ -192,6 +193,28 @@ EOT if (!$operations) { $io->write('Nothing to install/update'); } + + // force dev packages to be updated to latest reference on update + if ($update) { + foreach ($installedPackages as $package) { + if (!$package->isDev()) { + continue; + } + foreach ($operations as $operation) { + if (('update' === $operation->getJobType() && $package === $operation->getInitialPackage()) + || ('uninstall' === $operation->getJobType() && $package === $operation->getPackage()) + ) { + continue 2; + } + } + + // force update + $newPackage = $composer->getRepositoryManager()->findPackage($package->getName(), $package->getVersion()); + $operation = new UpdateOperation($package, $newPackage); + $operations[] = $operation; + } + } + foreach ($operations as $operation) { if ($verbose) { $io->write((string) $operation);