1
0
Fork 0

Merge branch '1.8'

pull/8017/head
Jordi Boggiano 2019-02-27 15:07:33 +01:00
commit ba1e5c213c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 29 additions and 1 deletions

View File

@ -43,6 +43,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
private $driver;
/** @var VersionCacheInterface */
private $versionCache;
private $emptyReferences = array();
public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
{
@ -117,6 +118,11 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
return $this->branchErrorOccurred;
}
public function getEmptyReferences()
{
return $this->emptyReferences;
}
protected function initialize()
{
parent::initialize();
@ -159,6 +165,10 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if ($cachedPackage) {
$this->addPackage($cachedPackage);
continue;
} elseif ($cachedPackage === false) {
$this->emptyReferences[] = $identifier;
continue;
}
@ -174,6 +184,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if ($verbose) {
$this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
}
$this->emptyReferences[] = $identifier;
continue;
}
@ -212,6 +223,9 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
$this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
} catch (\Exception $e) {
if ($e instanceof TransportException) {
$this->emptyReferences[] = $identifier;
}
if ($verbose) {
$this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
}
@ -258,6 +272,10 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if ($cachedPackage) {
$this->addPackage($cachedPackage);
continue;
} elseif ($cachedPackage === false) {
$this->emptyReferences[] = $identifier;
continue;
}
@ -266,6 +284,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if ($verbose) {
$this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
}
$this->emptyReferences[] = $identifier;
continue;
}
@ -284,6 +303,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
}
$this->addPackage($package);
} catch (TransportException $e) {
$this->emptyReferences[] = $identifier;
if ($verbose) {
$this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
}
@ -352,6 +372,14 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
}
$cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
if ($cachedPackage === false) {
if ($verbose) {
$this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
}
return false;
}
if ($cachedPackage) {
$msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
if ($verbose) {

View File

@ -17,7 +17,7 @@ interface VersionCacheInterface
/**
* @param string $version
* @param string $identifier
* @return array Package version data
* @return array|null|false Package version data if found, false to indicate the identifier is known but has no package, null for an unknown identifier
*/
public function getVersionPackage($version, $identifier);
}