Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistWorkflow.php
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | abstract class ArcanistWorkflow extends Phobject { | ||||
private $command; | private $command; | ||||
private $stashed; | private $stashed; | ||||
private $shouldAmend; | private $shouldAmend; | ||||
private $projectInfo; | private $projectInfo; | ||||
private $repositoryInfo; | private $repositoryInfo; | ||||
private $repositoryReasons; | private $repositoryReasons; | ||||
private $repositoryRef; | |||||
private $arcanistConfiguration; | private $arcanistConfiguration; | ||||
private $parentWorkflow; | private $parentWorkflow; | ||||
private $workingDirectory; | private $workingDirectory; | ||||
private $repositoryVersion; | private $repositoryVersion; | ||||
private $changeCache = array(); | private $changeCache = array(); | ||||
private $conduitEngine; | private $conduitEngine; | ||||
▲ Show 20 Lines • Show All 505 Lines • ▼ Show 20 Lines | /* -( Conduit )------------------------------------------------------------ */ | ||||
final protected function getParentWorkflow() { | final protected function getParentWorkflow() { | ||||
return $this->parentWorkflow; | return $this->parentWorkflow; | ||||
} | } | ||||
final public function buildChildWorkflow($command, array $argv) { | final public function buildChildWorkflow($command, array $argv) { | ||||
$arc_config = $this->getArcanistConfiguration(); | $arc_config = $this->getArcanistConfiguration(); | ||||
$workflow = $arc_config->buildWorkflow($command); | $workflow = $arc_config->buildWorkflow($command); | ||||
$workflow->setParentWorkflow($this); | $workflow->setParentWorkflow($this); | ||||
$workflow->setConduitEngine($this->getConduitEngine()); | |||||
$workflow->setCommand($command); | $workflow->setCommand($command); | ||||
$workflow->setConfigurationManager($this->getConfigurationManager()); | $workflow->setConfigurationManager($this->getConfigurationManager()); | ||||
if ($this->repositoryAPI) { | if ($this->repositoryAPI) { | ||||
$workflow->setRepositoryAPI($this->repositoryAPI); | $workflow->setRepositoryAPI($this->repositoryAPI); | ||||
} | } | ||||
if ($this->userPHID) { | if ($this->userPHID) { | ||||
▲ Show 20 Lines • Show All 1,475 Lines • ▼ Show 20 Lines | final public function setConduitEngine( | ||||
return $this; | return $this; | ||||
} | } | ||||
final public function getConduitEngine() { | final public function getConduitEngine() { | ||||
return $this->conduitEngine; | return $this->conduitEngine; | ||||
} | } | ||||
final protected function newWorkingCopyStateRef() { | final protected function newWorkingCopyStateRef() { | ||||
return new ArcanistWorkingCopyStateRef(); | $ref = new ArcanistWorkingCopyStateRef(); | ||||
$working_copy = $this->getWorkingCopy(); | |||||
$ref->setRootDirectory($working_copy->getProjectRoot()); | |||||
return $ref; | |||||
} | } | ||||
final protected function newRefQuery(array $refs) { | final protected function newRefQuery(array $refs) { | ||||
assert_instances_of($refs, 'ArcanistRef'); | assert_instances_of($refs, 'ArcanistRef'); | ||||
return id(new ArcanistRefQuery()) | |||||
->setRepositoryAPI($this->getRepositoryAPI()) | $query = id(new ArcanistRefQuery()) | ||||
->setConduitEngine($this->getConduitEngine()) | ->setConduitEngine($this->getConduitEngine()) | ||||
->setRefs($refs); | ->setRefs($refs); | ||||
if ($this->hasRepositoryAPI()) { | |||||
$query->setRepositoryAPI($this->getRepositoryAPI()); | |||||
} | |||||
$repository_ref = $this->getRepositoryRef(); | |||||
if ($repository_ref) { | |||||
$query->setRepositoryRef($repository_ref); | |||||
} | |||||
$working_copy = $this->getConfigurationManager()->getWorkingCopyIdentity(); | |||||
if ($working_copy) { | |||||
$working_ref = $this->newWorkingCopyStateRef(); | |||||
$query->setWorkingCopyRef($working_ref); | |||||
} | |||||
return $query; | |||||
} | |||||
final public function getRepositoryRef() { | |||||
if (!$this->getConfigurationManager()->getWorkingCopyIdentity()) { | |||||
return null; | |||||
} | |||||
if (!$this->repositoryAPI) { | |||||
return null; | |||||
} | |||||
if (!$this->repositoryRef) { | |||||
$ref = id(new ArcanistRepositoryRef()) | |||||
->setPHID($this->getRepositoryPHID()) | |||||
->setBrowseURI($this->getRepositoryURI()); | |||||
$this->repositoryRef = $ref; | |||||
} | |||||
return $this->repositoryRef; | |||||
} | } | ||||
} | } |