Changeset View
Changeset View
Standalone View
Standalone View
src/land/engine/ArcanistLandEngine.php
| Show All 22 Lines | abstract class ArcanistLandEngine | ||||
| private $ontoRemote; | private $ontoRemote; | ||||
| private $ontoRefs; | private $ontoRefs; | ||||
| private $intoRemote; | private $intoRemote; | ||||
| private $intoRef; | private $intoRef; | ||||
| private $intoEmpty; | private $intoEmpty; | ||||
| private $intoLocal; | private $intoLocal; | ||||
| private $localState; | private $localState; | ||||
| private $hasUnpushedChanges; | |||||
| final public function setOntoRemote($onto_remote) { | final public function setOntoRemote($onto_remote) { | ||||
| $this->ontoRemote = $onto_remote; | $this->ontoRemote = $onto_remote; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| final public function getOntoRemote() { | final public function getOntoRemote() { | ||||
| return $this->ontoRemote; | return $this->ontoRemote; | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | private function setLocalState(ArcanistRepositoryLocalState $local_state) { | ||||
| $this->localState = $local_state; | $this->localState = $local_state; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| final protected function getLocalState() { | final protected function getLocalState() { | ||||
| return $this->localState; | return $this->localState; | ||||
| } | } | ||||
| private function setHasUnpushedChanges($unpushed) { | |||||
| $this->hasUnpushedChanges = $unpushed; | |||||
| return $this; | |||||
| } | |||||
| final protected function getHasUnpushedChanges() { | |||||
| return $this->hasUnpushedChanges; | |||||
| } | |||||
| final protected function getOntoConfigurationKey() { | final protected function getOntoConfigurationKey() { | ||||
| return 'arc.land.onto'; | return 'arc.land.onto'; | ||||
| } | } | ||||
| final protected function getOntoFromConfiguration() { | final protected function getOntoFromConfiguration() { | ||||
| $config_key = $this->getOntoConfigurationKey(); | $config_key = $this->getOntoConfigurationKey(); | ||||
| return $this->getWorkflow()->getConfig($config_key); | return $this->getWorkflow()->getConfig($config_key); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 984 Lines • ▼ Show 20 Lines | try { | ||||
| foreach ($sets as $set_key => $set) { | foreach ($sets as $set_key => $set) { | ||||
| // Add these first, so we don't add them multiple times if we need | // Add these first, so we don't add them multiple times if we need | ||||
| // to retry a push. | // to retry a push. | ||||
| $need_prune[] = $set; | $need_prune[] = $set; | ||||
| $need_cascade[] = $set; | $need_cascade[] = $set; | ||||
| while (true) { | while (true) { | ||||
| $into_commit = $this->executeMerge($set, $into_commit); | $into_commit = $this->executeMerge($set, $into_commit); | ||||
| $this->setHasUnpushedChanges(true); | |||||
| if ($is_hold) { | if ($is_hold) { | ||||
| $should_push = false; | $should_push = false; | ||||
| } else if ($is_incremental) { | } else if ($is_incremental) { | ||||
| $should_push = true; | $should_push = true; | ||||
| } else { | } else { | ||||
| $is_last = ($set_key === $last_key); | $is_last = ($set_key === $last_key); | ||||
| $should_push = $is_last; | $should_push = $is_last; | ||||
| } | } | ||||
| if ($should_push) { | if ($should_push) { | ||||
| try { | try { | ||||
| $this->pushChange($into_commit); | $this->pushChange($into_commit); | ||||
| $this->setHasUnpushedChanges(false); | |||||
| } catch (Exception $ex) { | } catch (Exception $ex) { | ||||
| // TODO: If the push fails, fetch and retry if the remote ref | // TODO: If the push fails, fetch and retry if the remote ref | ||||
| // has moved ahead of us. | // has moved ahead of us. | ||||
| if ($this->getIntoLocal()) { | if ($this->getIntoLocal()) { | ||||
| $can_retry = false; | $can_retry = false; | ||||
| } else if ($this->getIntoEmpty()) { | } else if ($this->getIntoEmpty()) { | ||||
| ▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines | |||||