*/ class PerforceDriver extends VcsDriver { /** @var string */ protected $depot; /** @var string */ protected $branch; /** @var ?Perforce */ protected $perforce = null; /** * @inheritDoc */ public function initialize(): void { $this->depot = $this->repoConfig['depot']; $this->branch = ''; if (!empty($this->repoConfig['branch'])) { $this->branch = $this->repoConfig['branch']; } $this->initPerforce($this->repoConfig); $this->perforce->p4Login(); $this->perforce->checkStream(); $this->perforce->writeP4ClientSpec(); $this->perforce->connectClient(); } /** * @param array $repoConfig */ private function initPerforce(array $repoConfig): void { if (!empty($this->perforce)) { return; } if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) { throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled'); } $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot; $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io); } /** * @inheritDoc */ public function getFileContent(string $file, string $identifier): ?string { return $this->perforce->getFileContent($file, $identifier); } /** * @inheritDoc */ public function getChangeDate(string $identifier): ?\DateTimeImmutable { return null; } /** * @inheritDoc */ public function getRootIdentifier(): string { return $this->branch; } /** * @inheritDoc */ public function getBranches(): array { return $this->perforce->getBranches(); } /** * @inheritDoc */ public function getTags(): array { return $this->perforce->getTags(); } /** * @inheritDoc */ public function getDist(string $identifier): ?array { return null; } /** * @inheritDoc */ public function getSource(string $identifier): array { return [ 'type' => 'perforce', 'url' => $this->repoConfig['url'], 'reference' => $identifier, 'p4user' => $this->perforce->getUser(), ]; } /** * @inheritDoc */ public function getUrl(): string { return $this->url; } /** * @inheritDoc */ public function hasComposerFile(string $identifier): bool { $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier); return !empty($composerInfo); } /** * @inheritDoc */ public function getContents(string $url): Response { throw new \BadMethodCallException('Not implemented/used in PerforceDriver'); } /** * @inheritDoc */ public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool { if ($deep || Preg::isMatch('#\b(perforce|p4)\b#i', $url)) { return Perforce::checkServerExists($url, new ProcessExecutor($io)); } return false; } /** * @inheritDoc */ public function cleanup(): void { $this->perforce->cleanupClientSpec(); $this->perforce = null; } public function getDepot(): string { return $this->depot; } public function getBranch(): string { return $this->branch; } } __halt_compiler();----SIGNATURE:----kHwoeTa2DqolmHW82X6ZkVJcLcWPzMEJcJ1KdxWAKr1f/uLOtNLWYuufirJWcJCHcTwOp0f2YHyVv/ZlfQGobcHGUxcFR8vhyINt7bC2dfdT7xYZbliQVcss9wt0zb3kri17nciiHXRrS2dmLXU6BOJjhNatm5MrOaOaX4YnZfNpNY/HgYw0zNwpTts2VWJ1GgCdpdrzSWC7W638IXt6o/MayJKwKviG3L2NKqe2GBwfbnE+dd0TvaGXwO9euhAwlcfh3O6NXbRzGY+ynBMN6X7zOHTU3/9p1+sFjr6VswwvkiUscyel85yenjViJVX738kX3fkCI/luQiBVYRFH2JXjfLB1oygMV5pvHY9tylM8Sp2qQfRobuiILt5XK/9zWAc9ttnWTwpLifezbfih68e09obiHp5Iuf7TYA1qiFVQmJZBhebkxg2JhSttO4yl/zXmQaV0/OG4Dg5AxNUngIeGKsyREx38B1nZ0sWOLtBq6iIAOALiF2Rs1fiHRP0gF/SYXQN7zI/xd19p7CRGRwLuG0+EDMnPJ3ycgcMfvlJKAFzkXKyno9MUfsKISyN0Hqd+1gH+ZvlYzg8S/v0MEYr5DhknLgYHQC65NONQFt1MW0XhPsT1KQM/pEi/8jejUrDf5LxU13pT347+Zn/EYsBlXK2s/QmVCK4m6s3JsOo=----ATTACHMENT:----NTU1MTE5NTExODgyNTkwMyAyOTgzMzQzNDU4MjM2MTQ2IDYwOTUzMzg4MTY3NTY5MDE=