Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SvnDownloader.php

function SvnDownloader::getCommitLogs

@inheritDoc

Overrides VcsDownloader::getCommitLogs

File

vendor/composer/composer/src/Composer/Downloader/SvnDownloader.php, line 193

Class

SvnDownloader
@author Ben Bieker <mail@ben-bieker.de> @author Till Klampaeckel <till@php.net>

Namespace

Composer\Downloader

Code

protected function getCommitLogs(string $fromReference, string $toReference, string $path) : string {
    if (Preg::isMatch('{@(\\d+)$}', $fromReference) && Preg::isMatch('{@(\\d+)$}', $toReference)) {
        // retrieve the svn base url from the checkout folder
        $command = [
            'svn',
            'info',
            '--non-interactive',
            '--xml',
            '--',
            $path,
        ];
        if (0 !== $this->process
            ->execute($command, $output, $path)) {
            throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process
                ->getErrorOutput());
        }
        $urlPattern = '#<url>(.*)</url>#';
        if (Preg::isMatchStrictGroups($urlPattern, $output, $matches)) {
            $baseUrl = $matches[1];
        }
        else {
            throw new \RuntimeException('Unable to determine svn url for path ' . $path);
        }
        // strip paths from references and only keep the actual revision
        $fromRevision = Preg::replace('{.*@(\\d+)$}', '$1', $fromReference);
        $toRevision = Preg::replace('{.*@(\\d+)$}', '$1', $toReference);
        $command = [
            'svn',
            'log',
            '-r',
            $fromRevision . ':' . $toRevision,
            '--incremental',
        ];
        $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
        $util->setCacheCredentials($this->cacheCredentials);
        try {
            return $util->executeLocal($command, $path, null, $this->io
                ->isVerbose());
        } catch (\RuntimeException $e) {
            throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $e->getMessage());
        }
    }
    return "Could not retrieve changes between {$fromReference} and {$toReference} due to missing revision information";
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal