Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepository.php
Show First 20 Lines • Show All 2,522 Lines • ▼ Show 20 Lines | private function synchronizeWorkingCopyFromDevices(array $device_phids) { | ||||
if ($caught) { | if ($caught) { | ||||
throw $caught; | throw $caught; | ||||
} | } | ||||
} | } | ||||
private function synchronizeWorkingCopyFromBinding($binding) { | private function synchronizeWorkingCopyFromBinding($binding) { | ||||
$fetch_uri = $this->getClusterRepositoryURIFromBinding($binding); | $fetch_uri = $this->getClusterRepositoryURIFromBinding($binding); | ||||
$local_path = $this->getLocalPath(); | |||||
if ($this->isGit()) { | if ($this->isGit()) { | ||||
if (!Filesystem::pathExists($local_path)) { | |||||
$device = AlmanacKeys::getLiveDevice(); | |||||
throw new Exception( | |||||
pht( | |||||
'Repository "%s" does not have a working copy on this device '. | |||||
'yet, so it can not be synchronized. Wait for the daemons to '. | |||||
'construct one or run `bin/repository update %s` on this host '. | |||||
'("%s") to build it explicitly.', | |||||
$this->getDisplayName(), | |||||
$this->getMonogram(), | |||||
$device->getName())); | |||||
} | |||||
$argv = array( | $argv = array( | ||||
'fetch --prune -- %s %s', | 'fetch --prune -- %s %s', | ||||
$fetch_uri, | $fetch_uri, | ||||
'+refs/*:refs/*', | '+refs/*:refs/*', | ||||
); | ); | ||||
} else { | } else { | ||||
throw new Exception(pht('Binding sync only supported for git!')); | throw new Exception(pht('Binding sync only supported for git!')); | ||||
} | } | ||||
$future = DiffusionCommandEngine::newCommandEngine($this) | $future = DiffusionCommandEngine::newCommandEngine($this) | ||||
->setArgv($argv) | ->setArgv($argv) | ||||
->setConnectAsDevice(true) | ->setConnectAsDevice(true) | ||||
->setSudoAsDaemon(true) | ->setSudoAsDaemon(true) | ||||
->setProtocol($fetch_uri->getProtocol()) | ->setProtocol($fetch_uri->getProtocol()) | ||||
->newFuture(); | ->newFuture(); | ||||
$future->setCWD($this->getLocalPath()); | $future->setCWD($local_path); | ||||
$future->resolvex(); | $future->resolvex(); | ||||
} | } | ||||
private function getClusterRepositoryURIFromBinding( | private function getClusterRepositoryURIFromBinding( | ||||
AlmanacBinding $binding) { | AlmanacBinding $binding) { | ||||
$protocol = $binding->getAlmanacPropertyValue('protocol'); | $protocol = $binding->getAlmanacPropertyValue('protocol'); | ||||
if ($protocol === null) { | if ($protocol === null) { | ||||
▲ Show 20 Lines • Show All 277 Lines • Show Last 20 Lines |