Skip to content

Commit

Permalink
Fix SVN support
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsykun committed Sep 14, 2024
1 parent f5b0bdb commit 0b0b0dd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/Entity/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,20 @@ public function getSource()
return $this->source ? json_decode($this->source, true) : null;
}

public function getSourceType(): ?string
{
$type = ($this->getSource()['type'] ?? null);

return is_string($type) ? $type : null;
}

public function getSourceReference(): ?string
{
$reference = $this->getSource()['reference'] ?? null;

return is_string($reference) ? $reference : null;
}

/**
* Set dist
*
Expand Down
10 changes: 10 additions & 0 deletions src/Package/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,16 @@ private function updateArchive(PackageInterface $data, Package $package): ?array
return null;
}

// svn support
if ($data->getSourceType() === 'svn' && $data->getSourceReference()) {
$virtualReference = sha1($data->getSourceReference());
return [
'url' => $this->distConfig->generateRoute($data->getName(), $virtualReference, $this->distConfig->getArchiveFormat()),
'type' => $this->distConfig->getArchiveFormat(),
'reference' => $virtualReference
];
}

if ($this->distConfig->isPreBuild()) {
$path = null;
try {
Expand Down
2 changes: 1 addition & 1 deletion src/Service/DistManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private function downloadVCS(string $reference, Package $package, ?string $versi
}

$probe = $versionName ? $this->tryFromVersion($package, $versionName) : null;
if (null === $probe || $probe->getSourceReference() !== $reference) {
if (null === $probe || ($probe->getSourceReference() !== $reference && $probe->getSourceType() !== 'svn')) {
$probe = $this->guessCompletePackage($reference, $repository->getPackages());
}

Expand Down

0 comments on commit 0b0b0dd

Please sign in to comment.