Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistWorkflow.php
Show First 20 Lines • Show All 330 Lines • ▼ Show 20 Lines | final public function establishConduit() { | ||||
if ($this->conduitTimeout) { | if ($this->conduitTimeout) { | ||||
$this->conduit->setTimeout($this->conduitTimeout); | $this->conduit->setTimeout($this->conduitTimeout); | ||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
final public function getConfigFromAnySource($key) { | final public function getConfigFromAnySource($key) { | ||||
$source_list = $this->getConfigurationSourceList(); | |||||
if ($source_list) { | |||||
$value_list = $source_list->getStorageValueList($key); | |||||
if ($value_list) { | |||||
return last($value_list)->getValue(); | |||||
} | |||||
return null; | |||||
} | |||||
return $this->configurationManager->getConfigFromAnySource($key); | return $this->configurationManager->getConfigFromAnySource($key); | ||||
} | } | ||||
/** | /** | ||||
* Set credentials which will be used to authenticate against Conduit. These | * Set credentials which will be used to authenticate against Conduit. These | ||||
* credentials can then be used to establish an authenticated connection to | * credentials can then be used to establish an authenticated connection to | ||||
* conduit by calling @{method:authenticateConduit}. Arcanist sets some | * conduit by calling @{method:authenticateConduit}. Arcanist sets some | ||||
▲ Show 20 Lines • Show All 532 Lines • ▼ Show 20 Lines | final public function parseArguments(array $args) { | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function didParseArguments() { | protected function didParseArguments() { | ||||
// Override this to customize workflow argument behavior. | // Override this to customize workflow argument behavior. | ||||
} | } | ||||
final public function getWorkingCopy() { | final public function getWorkingCopy() { | ||||
$configuration_engine = $this->getConfigurationEngine(); | |||||
if ($configuration_engine) { | |||||
$working_copy = $configuration_engine->getWorkingCopy(); | |||||
$working_path = $working_copy->getWorkingDirectory(); | |||||
return ArcanistWorkingCopyIdentity::newFromPath($working_path); | |||||
} | |||||
$working_copy = $this->getConfigurationManager()->getWorkingCopyIdentity(); | $working_copy = $this->getConfigurationManager()->getWorkingCopyIdentity(); | ||||
if (!$working_copy) { | if (!$working_copy) { | ||||
$workflow = get_class($this); | $workflow = get_class($this); | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
"This workflow ('%s') requires a working copy, override ". | "This workflow ('%s') requires a working copy, override ". | ||||
"%s to return true.", | "%s to return true.", | ||||
$workflow, | $workflow, | ||||
Show All 11 Lines | final public function hasRepositoryAPI() { | ||||
try { | try { | ||||
return (bool)$this->getRepositoryAPI(); | return (bool)$this->getRepositoryAPI(); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
final public function getRepositoryAPI() { | final public function getRepositoryAPI() { | ||||
$configuration_engine = $this->getConfigurationEngine(); | |||||
if ($configuration_engine) { | |||||
$working_copy = $configuration_engine->getWorkingCopy(); | |||||
return $working_copy->getRepositoryAPI(); | |||||
} | |||||
if (!$this->repositoryAPI) { | if (!$this->repositoryAPI) { | ||||
$workflow = get_class($this); | $workflow = get_class($this); | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
"This workflow ('%s') requires a Repository API, override ". | "This workflow ('%s') requires a Repository API, override ". | ||||
"%s to return true.", | "%s to return true.", | ||||
$workflow, | $workflow, | ||||
'requiresRepositoryAPI()')); | 'requiresRepositoryAPI()')); | ||||
▲ Show 20 Lines • Show All 1,305 Lines • ▼ Show 20 Lines | if ($this->hasRepositoryAPI()) { | ||||
$query->setRepositoryAPI($this->getRepositoryAPI()); | $query->setRepositoryAPI($this->getRepositoryAPI()); | ||||
} | } | ||||
$repository_ref = $this->getRepositoryRef(); | $repository_ref = $this->getRepositoryRef(); | ||||
if ($repository_ref) { | if ($repository_ref) { | ||||
$query->setRepositoryRef($repository_ref); | $query->setRepositoryRef($repository_ref); | ||||
} | } | ||||
$working_copy = $this->getConfigurationManager()->getWorkingCopyIdentity(); | $working_copy = $this->getWorkingCopy(); | ||||
if ($working_copy) { | if ($working_copy) { | ||||
$working_ref = $this->newWorkingCopyStateRef(); | $working_ref = $this->newWorkingCopyStateRef(); | ||||
$query->setWorkingCopyRef($working_ref); | $query->setWorkingCopyRef($working_ref); | ||||
} | } | ||||
return $query; | return $query; | ||||
} | } | ||||
final public function getRepositoryRef() { | final public function getRepositoryRef() { | ||||
$configuration_engine = $this->getConfigurationEngine(); | |||||
if ($configuration_engine) { | |||||
// This is a toolset workflow and can always build a repository ref. | |||||
} else { | |||||
if (!$this->getConfigurationManager()->getWorkingCopyIdentity()) { | if (!$this->getConfigurationManager()->getWorkingCopyIdentity()) { | ||||
return null; | return null; | ||||
} | } | ||||
if (!$this->repositoryAPI) { | if (!$this->repositoryAPI) { | ||||
return null; | return null; | ||||
} | } | ||||
} | |||||
if (!$this->repositoryRef) { | if (!$this->repositoryRef) { | ||||
$ref = id(new ArcanistRepositoryRef()) | $ref = id(new ArcanistRepositoryRef()) | ||||
->setPHID($this->getRepositoryPHID()) | ->setPHID($this->getRepositoryPHID()) | ||||
->setBrowseURI($this->getRepositoryURI()); | ->setBrowseURI($this->getRepositoryURI()); | ||||
$this->repositoryRef = $ref; | $this->repositoryRef = $ref; | ||||
} | } | ||||
Show All 27 Lines |