diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php index edd0dabf8..8d8bcbdca 100644 --- a/src/Composer/Repository/VcsRepository.php +++ b/src/Composer/Repository/VcsRepository.php @@ -30,7 +30,8 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt { protected $url; protected $packageName; - protected $verbose; + protected $isVerbose; + protected $isVeryVerbose; protected $io; protected $config; protected $versionParser; @@ -64,7 +65,8 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt $this->url = $repoConfig['url']; $this->io = $io; $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs'; - $this->verbose = $io->isVeryVerbose(); + $this->isVerbose = $io->isVerbose(); + $this->isVeryVerbose = $io->isVeryVerbose(); $this->config = $config; $this->repoConfig = $repoConfig; $this->versionCache = $versionCache; @@ -127,7 +129,8 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt { parent::initialize(); - $verbose = $this->verbose; + $isVerbose = $this->isVerbose; + $isVeryVerbose = $this->isVeryVerbose; $driver = $this->getDriver(); if (!$driver) { @@ -145,23 +148,23 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt $this->packageName = !empty($data['name']) ? $data['name'] : null; } } catch (\Exception $e) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().''); } } foreach ($driver->getTags() as $tag => $identifier) { $msg = 'Reading composer.json of ' . ($this->packageName ?: $this->url) . ' (' . $tag . ')'; - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError($msg); - } else { + } elseif ($isVerbose) { $this->io->overwriteError($msg, false); } // strip the release- prefix from tags if present $tag = str_replace('release-', '', $tag); - $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $verbose); + $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose); if ($cachedPackage) { $this->addPackage($cachedPackage); @@ -173,7 +176,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt } if (!$parsedTag = $this->validateTag($tag)) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped tag '.$tag.', invalid tag name'); } continue; @@ -181,7 +184,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt try { if (!$data = $driver->getComposerInformation($identifier)) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped tag '.$tag.', no composer file'); } $this->emptyReferences[] = $identifier; @@ -203,7 +206,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt // broken package, version doesn't match tag if ($data['version_normalized'] !== $parsedTag) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json'); } continue; @@ -211,13 +214,13 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName; if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally'); } continue; } - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')'); } @@ -226,35 +229,35 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt if ($e instanceof TransportException && $e->getCode() === 404) { $this->emptyReferences[] = $identifier; } - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).''); } continue; } } - if (!$verbose) { + if (!$isVeryVerbose) { $this->io->overwriteError('', false); } $branches = $driver->getBranches(); foreach ($branches as $branch => $identifier) { $msg = 'Reading composer.json of ' . ($this->packageName ?: $this->url) . ' (' . $branch . ')'; - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError($msg); - } else { + } elseif ($isVerbose) { $this->io->overwriteError($msg, false); } if ($branch === 'trunk' && isset($branches['master'])) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally'); } continue; } if (!$parsedBranch = $this->validateBranch($branch)) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped branch '.$branch.', invalid name'); } continue; @@ -268,7 +271,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch); } - $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $verbose); + $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose); if ($cachedPackage) { $this->addPackage($cachedPackage); @@ -281,7 +284,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt try { if (!$data = $driver->getComposerInformation($identifier)) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped branch '.$branch.', no composer file'); } $this->emptyReferences[] = $identifier; @@ -292,7 +295,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt $data['version'] = $version; $data['version_normalized'] = $parsedBranch; - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')'); } @@ -306,12 +309,12 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt if ($e->getCode() === 404) { $this->emptyReferences[] = $identifier; } - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped branch '.$branch.', no composer file was found'); } continue; } catch (\Exception $e) { - if (!$verbose) { + if (!$isVeryVerbose) { $this->io->writeError(''); } $this->branchErrorOccurred = true; @@ -322,7 +325,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt } $driver->cleanup(); - if (!$verbose) { + if (!$isVeryVerbose) { $this->io->overwriteError('', false); } @@ -367,7 +370,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt return false; } - private function getCachedPackageVersion($version, $identifier, $verbose) + private function getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose) { if (!$this->versionCache) { return; @@ -375,7 +378,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier); if ($cachedPackage === false) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped '.$version.', no composer file (cached from ref '.$identifier.')'); } @@ -384,14 +387,14 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt if ($cachedPackage) { $msg = 'Found cached composer.json of ' . ($this->packageName ?: $this->url) . ' (' . $version . ')'; - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError($msg); - } else { + } elseif ($isVerbose) { $this->io->overwriteError($msg, false); } if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) { - if ($verbose) { + if ($isVeryVerbose) { $this->io->writeError('Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally'); } $cachedPackage = null;