1
0
Fork 0

Improve output of operations to show details about dev versions

pull/668/merge
Jordi Boggiano 2012-05-09 17:31:12 +02:00
parent bd9aa6a288
commit fafd09a7ba
4 changed files with 13 additions and 4 deletions

View File

@ -61,6 +61,6 @@ class InstallOperation extends SolverOperation
*/
public function __toString()
{
return 'Installing '.$this->package->getPrettyName().' ('.$this->package->getPrettyVersion().')';
return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
}
}

View File

@ -42,4 +42,13 @@ abstract class SolverOperation implements OperationInterface
{
return $this->reason;
}
protected function formatVersion(PackageInterface $package)
{
if (!$package->isDev() || !in_array($package->getSourceType(), array('hg', 'git'))) {
return $package->getPrettyVersion();
}
return $package->getPrettyVersion().' '.substr($package->getSourceReference(), 0, 6);
}
}

View File

@ -61,6 +61,6 @@ class UninstallOperation extends SolverOperation
*/
public function __toString()
{
return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->package->getPrettyVersion().')';
return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
}
}

View File

@ -74,7 +74,7 @@ class UpdateOperation extends SolverOperation
*/
public function __toString()
{
return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->initialPackage->getPrettyVersion().') to '.
$this->targetPackage->getPrettyName(). ' ('.$this->targetPackage->getPrettyVersion().')';
return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
$this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
}
}