Changeset View
Changeset View
Standalone View
Standalone View
src/land/engine/ArcanistLandEngine.php
Show First 20 Lines • Show All 1,287 Lines • ▼ Show 20 Lines | try { | ||||
if ($need_cascade) { | if ($need_cascade) { | ||||
// NOTE: We cascade each set we've pushed, but we're going to | // NOTE: We cascade each set we've pushed, but we're going to | ||||
// cascade them from most recent to least recent. This way, | // cascade them from most recent to least recent. This way, | ||||
// branches which descend from more recent changes only cascade | // branches which descend from more recent changes only cascade | ||||
// once, directly in to the correct state. | // once, directly in to the correct state. | ||||
$need_cascade = array_reverse($need_cascade); | $need_cascade = array_reverse($need_cascade); | ||||
foreach ($need_cascade as $cascade_set) { | foreach ($need_cascade as $cascade_set) { | ||||
$this->cascadeState($set, $into_commit); | $this->cascadeState($set, $into_commit); | ||||
} | } | ||||
cspeckmim: I'm poking around some and noticed this doesn't make use of `$cascade_set` but passes `$set`… | |||||
epriestleyUnsubmitted Not Done Inline ActionsAh, yes. I think this likely requires the use of --incremental and/or arc land a b ... to actually hit (and might sometimes/often be moot -- we'll just cascade "too much" stuff, which is generally a no-op, maybe?) which is perhaps why it has escaped notice. epriestley: Ah, yes. I think this likely requires the use of `--incremental` and/or `arc land a b ...` to… | |||||
$need_cascade = array(); | $need_cascade = array(); | ||||
} | } | ||||
if (!$is_keep) { | if (!$is_keep) { | ||||
$this->pruneBranches($need_prune); | $this->pruneBranches($need_prune); | ||||
$need_prune = array(); | $need_prune = array(); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
abstract protected function selectIntoRemote(); | abstract protected function selectIntoRemote(); | ||||
abstract protected function selectIntoRef(); | abstract protected function selectIntoRef(); | ||||
abstract protected function selectIntoCommit(); | abstract protected function selectIntoCommit(); | ||||
abstract protected function selectCommits($into_commit, array $symbols); | abstract protected function selectCommits($into_commit, array $symbols); | ||||
abstract protected function executeMerge( | abstract protected function executeMerge( | ||||
ArcanistLandCommitSet $set, | ArcanistLandCommitSet $set, | ||||
$into_commit); | $into_commit); | ||||
abstract protected function pushChange($into_commit); | abstract protected function pushChange($into_commit); | ||||
/** | |||||
* Update all local refs that depend on refs selected-and-modified during the | |||||
* land. E.g. with branches named change1 -> change2 -> change3 and using | |||||
* `arc land change2`, in the general case the local change3 should be | |||||
* rebased onto the landed version of change2 so that it no longer has | |||||
* out-of-date ancestors. | |||||
* | |||||
* When multiple revisions are landed at once this will be called in a loop | |||||
* for each set, in order of max to min, where max is the latest descendant | |||||
* and min is the earliest ancestor. This is done so that non-landing commits | |||||
* that are descendants of the latest revision will only be rebased once. | |||||
* | |||||
* @param ArcanistLandCommitSet The current commit set to cascade. | |||||
*/ | |||||
abstract protected function cascadeState( | abstract protected function cascadeState( | ||||
ArcanistLandCommitSet $set, | ArcanistLandCommitSet $set, | ||||
$into_commit); | $into_commit); | ||||
protected function isSquashStrategy() { | protected function isSquashStrategy() { | ||||
return ($this->getStrategy() === 'squash'); | return ($this->getStrategy() === 'squash'); | ||||
} | } | ||||
/** | |||||
* Prunes the given sets of commits. This should be called after the sets | |||||
* have been merged. | |||||
* | |||||
* @param array The list of ArcanistLandCommitSet to prune, in order of | |||||
* min to max commit set, where min is the earliest ancestor and max | |||||
* is the latest descendant. | |||||
*/ | |||||
abstract protected function pruneBranches(array $sets); | abstract protected function pruneBranches(array $sets); | ||||
/** | |||||
* Restore the local repository to an expected state after landing. This | |||||
* should only be called after all changes have been merged, pruned, and | |||||
* pushed. | |||||
* | |||||
* @param string The commit hash that was landed into. | |||||
* @param ArcanistRepositoryLocalState The local state that was captured | |||||
* at the beginning of the land process. This may include stashed changes. | |||||
*/ | |||||
abstract protected function reconcileLocalState( | abstract protected function reconcileLocalState( | ||||
$into_commit, | $into_commit, | ||||
ArcanistRepositoryLocalState $state); | ArcanistRepositoryLocalState $state); | ||||
/** | |||||
* Display information to the user about how to proceed since the land | |||||
* process was not fully completed. The merged branch has not been pushed. | |||||
* | |||||
* @param string The commit hash that was landed into. | |||||
*/ | |||||
abstract protected function didHoldChanges($into_commit); | abstract protected function didHoldChanges($into_commit); | ||||
private function selectMergeStrategy() { | private function selectMergeStrategy() { | ||||
$log = $this->getLogEngine(); | $log = $this->getLogEngine(); | ||||
$supported_strategies = array( | $supported_strategies = array( | ||||
'merge', | 'merge', | ||||
'squash', | 'squash', | ||||
▲ Show 20 Lines • Show All 150 Lines • Show Last 20 Lines |
I'm poking around some and noticed this doesn't make use of $cascade_set but passes $set for the cascade. Should this be
I haven't noticed any issues in using Arcanist but I don't think I regularly hit the cascade path either.