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

Breadcrumb

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

function SvnDriver::getBranches

@inheritDoc

Overrides VcsDriverInterface::getBranches

1 call to SvnDriver::getBranches()
SvnDriver::initialize in vendor/composer/composer/src/Composer/Repository/Vcs/SvnDriver.php
@inheritDoc

File

vendor/composer/composer/src/Composer/Repository/Vcs/SvnDriver.php, line 263

Class

SvnDriver
@author Jordi Boggiano <j.boggiano@seld.be> @author Till Klampaeckel <till@php.net>

Namespace

Composer\Repository\Vcs

Code

public function getBranches() : array {
    if (null === $this->branches) {
        $branches = [];
        if (false === $this->trunkPath) {
            $trunkParent = $this->baseUrl . '/';
        }
        else {
            $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
        }
        $output = $this->execute([
            'svn',
            'ls',
            '--verbose',
        ], $trunkParent);
        if ($output !== '') {
            foreach ($this->process
                ->splitLines($output) as $line) {
                $line = trim($line);
                if ($line !== '' && Preg::isMatch('{^\\s*(\\S+).*?(\\S+)\\s*$}', $line, $match)) {
                    if ($match[2] === './') {
                        $branches['trunk'] = $this->buildIdentifier('/' . $this->trunkPath, (int) $match[1]);
                        $this->rootIdentifier = $branches['trunk'];
                        break;
                    }
                }
            }
        }
        unset($output);
        if ($this->branchesPath !== false) {
            $output = $this->execute([
                'svn',
                'ls',
                '--verbose',
            ], $this->baseUrl . '/' . $this->branchesPath);
            if ($output !== '') {
                $lastRev = 0;
                foreach ($this->process
                    ->splitLines(trim($output)) as $line) {
                    $line = trim($line);
                    if ($line !== '' && Preg::isMatch('{^\\s*(\\S+).*?(\\S+)\\s*$}', $line, $match)) {
                        if ($match[2] === './') {
                            $lastRev = (int) $match[1];
                        }
                        else {
                            $branches[rtrim($match[2], '/')] = $this->buildIdentifier('/' . $this->branchesPath . '/' . $match[2], max($lastRev, (int) $match[1]));
                        }
                    }
                }
            }
        }
        $this->branches = $branches;
    }
    return $this->branches;
}
RSS feed
Powered by Drupal