1
0
Fork 0

Fix forcing of the source-ref from lock file

pull/329/head
Jordi Boggiano 2012-02-19 16:34:35 +01:00
parent 4233a4823d
commit c95b4d05fd
2 changed files with 13 additions and 6 deletions

View File

@ -236,9 +236,11 @@ EOT
$package = $operation->getPackage();
}
if ($package && $package->isDev()) {
foreach ($composer->getLocker()->getLockedPackages() as $lockedPackage) {
$lockData = $composer->getLocker()->getLockData();
foreach ($lockData['packages'] as $lockedPackage) {
if (!empty($lockedPackage['source-reference']) && strtolower($lockedPackage['package']) === $package->getName()) {
$package->setSourceReference($lockedPackage['source-reference']);
break;
}
}
}

View File

@ -69,11 +69,7 @@ class Locker
*/
public function getLockedPackages()
{
if (!$this->isLocked()) {
throw new \LogicException('No lockfile found. Unable to read locked packages');
}
$lockList = $this->lockFile->read();
$lockList = $this->getLockData();
$packages = array();
foreach ($lockList['packages'] as $info) {
$package = $this->repositoryManager->getLocalRepository()->findPackage($info['package'], $info['version']);
@ -95,6 +91,15 @@ class Locker
return $packages;
}
public function getLockData()
{
if (!$this->isLocked()) {
throw new \LogicException('No lockfile found. Unable to read locked packages');
}
return $this->lockFile->read();
}
/**
* Locks provided packages into lockfile.
*