Distinguish between updates and downgrades in dry-run
parent
5843a282bc
commit
a180f48921
|
@ -13,6 +13,7 @@
|
|||
namespace Composer\DependencyResolver\Operation;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
|
||||
/**
|
||||
* Solver update operation.
|
||||
|
@ -74,7 +75,9 @@ class UpdateOperation extends SolverOperation
|
|||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
|
||||
$actionName = VersionParser::isUpgrade($this->initialPackage->getVersion(), $this->targetPackage->getVersion()) ? 'Updating' : 'Downgrading';
|
||||
|
||||
return $actionName.' '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
|
||||
$this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,6 @@ update c/uptodate
|
|||
"platform-dev": []
|
||||
}
|
||||
--EXPECT--
|
||||
Updating b/unstable (1.1.0-alpha) to b/unstable (1.0.0)
|
||||
Downgrading b/unstable (1.1.0-alpha) to b/unstable (1.0.0)
|
||||
Updating a/old (0.9.0) to a/old (1.0.0)
|
||||
Installing d/removed (1.0.0)
|
||||
|
|
|
@ -74,8 +74,8 @@ update b/unstable
|
|||
"platform-dev": []
|
||||
}
|
||||
--EXPECT--
|
||||
Updating b/unstable (1.1.0-alpha) to b/unstable (1.0.0)
|
||||
Downgrading b/unstable (1.1.0-alpha) to b/unstable (1.0.0)
|
||||
Updating a/old (0.9.0) to a/old (1.0.0)
|
||||
Updating c/uptodate (2.0.0) to c/uptodate (1.0.0)
|
||||
Downgrading c/uptodate (2.0.0) to c/uptodate (1.0.0)
|
||||
Installing d/removed (1.0.0)
|
||||
Installing e/newreq (1.0.0)
|
||||
|
|
|
@ -48,4 +48,4 @@ update b/unstable
|
|||
"platform-dev": []
|
||||
}
|
||||
--EXPECT--
|
||||
Updating b/unstable (1.1.0-alpha) to b/unstable (1.0.0)
|
||||
Downgrading b/unstable (1.1.0-alpha) to b/unstable (1.0.0)
|
||||
|
|
|
@ -46,4 +46,4 @@ Downgrading from unstable to more stable package should work even if already ins
|
|||
--RUN--
|
||||
update
|
||||
--EXPECT--
|
||||
Updating a/a (dev-master abcd) to a/a (1.0.0)
|
||||
Downgrading a/a (dev-master abcd) to a/a (1.0.0)
|
||||
|
|
|
@ -37,4 +37,4 @@ Updates packages to their lowest stable version
|
|||
update --prefer-lowest --prefer-stable
|
||||
--EXPECT--
|
||||
Updating a/a (1.0.0-rc1) to a/a (1.0.1)
|
||||
Updating a/b (1.0.1) to a/b (1.0.0)
|
||||
Downgrading a/b (1.0.1) to a/b (1.0.0)
|
||||
|
|
Loading…
Reference in New Issue