Skip to content

Commit

Permalink
Show package source in very verbose updates, fixes #11733
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Dec 19, 2023
1 parent e0f7527 commit 7df489c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Composer/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,14 @@ protected function doUpdate(InstalledRepositoryInterface $localRepo, bool $doIns

// output op if lock file is enabled, but alias op only in debug verbosity
if ($this->config->get('lock') && (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug())) {
$this->io->writeError(' - ' . $operation->show(true));
$sourceRepo = '';
if ($this->io->isVeryVerbose() && false === strpos($operation->getOperationType(), 'Alias')) {
$operationPkg = ($operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage());
if ($operationPkg->getRepository() !== null) {
$sourceRepo = ' from ' . $operationPkg->getRepository()->getRepoName();
}
}
$this->io->writeError(' - ' . $operation->show(true) . $sourceRepo);
}
}

Expand Down
23 changes: 23 additions & 0 deletions tests/Composer/Test/Command/UpdateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,29 @@ public static function provideUpdates(): \Generator
OUTPUT
];

yield 'simple update with very verbose output' => [
$rootDepAndTransitiveDep,
['-vv' => true],
<<<OUTPUT
Loading composer repositories with package information
Pool optimizer completed in 0.001 seconds
Found 102 package versions referenced in your dependency graph. 2 (2%) were optimized away.
Updating dependencies
Dependency resolution completed in 0.000 seconds
Analyzed 100 packages to resolve dependencies
Analyzed 100 rules to resolve dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
Installs: dep/pkg:1.0.2, root/req:1.0.0
- Locking dep/pkg (1.0.2) from package repo (defining 4 packages)
- Locking root/req (1.0.0) from package repo (defining 4 packages)
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
Installs: dep/pkg:1.0.2, root/req:1.0.0
- Installing dep/pkg (1.0.2)
- Installing root/req (1.0.0)
OUTPUT
];

yield 'update with temporary constraint + --no-install' => [
$rootDepAndTransitiveDep,
['--with' => ['dep/pkg:1.0.0'], '--no-install' => true],
Expand Down

0 comments on commit 7df489c

Please sign in to comment.