Changeset View
Changeset View
Standalone View
Standalone View
src/land/engine/ArcanistGitLandEngine.php
| Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | private function fetchTarget(ArcanistLandTarget $target) { | ||||
| return $this->getLandTargetLocalCommit($target); | return $this->getLandTargetLocalCommit($target); | ||||
| } | } | ||||
| protected function executeMerge(ArcanistLandCommitSet $set, $into_commit) { | protected function executeMerge(ArcanistLandCommitSet $set, $into_commit) { | ||||
| $api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
| $log = $this->getLogEngine(); | $log = $this->getLogEngine(); | ||||
| $this->confirmLegacyStrategyConfiguration(); | |||||
| $is_empty = ($into_commit === null); | $is_empty = ($into_commit === null); | ||||
| if ($is_empty) { | if ($is_empty) { | ||||
| $empty_commit = ArcanistGitRawCommit::newEmptyCommit(); | $empty_commit = ArcanistGitRawCommit::newEmptyCommit(); | ||||
| $into_commit = $api->writeRawCommit($empty_commit); | $into_commit = $api->writeRawCommit($empty_commit); | ||||
| } | } | ||||
| $api->execxLocal('checkout %s --', $into_commit); | $api->execxLocal('checkout %s --', $into_commit); | ||||
| ▲ Show 20 Lines • Show All 1,184 Lines • ▼ Show 20 Lines | foreach ($this->getOntoRefs() as $onto_ref) { | ||||
| '%s:%s', | '%s:%s', | ||||
| $this->getDisplayHash($into_commit), | $this->getDisplayHash($into_commit), | ||||
| $onto_ref); | $onto_ref); | ||||
| } | } | ||||
| return $refspecs; | return $refspecs; | ||||
| } | } | ||||
| private function confirmLegacyStrategyConfiguration() { | |||||
| // TODO: See T13547. Remove this check in the future. This prevents users | |||||
Lint: TODO Comment: This comment has a TODO. | |||||
| // from accidentally executing a "squash" workflow under a configuration | |||||
| // which would previously have executed a "merge" workflow. | |||||
| // We're fine if we have an explicit "--strategy". | |||||
| if ($this->getStrategyArgument() !== null) { | |||||
| return; | |||||
| } | |||||
| // We're fine if we have an explicit "arc.land.strategy". | |||||
| if ($this->getStrategyFromConfiguration() !== null) { | |||||
| return; | |||||
| } | |||||
| // We're fine if "history.immutable" is not set to "true". | |||||
| $source_list = $this->getWorkflow()->getConfigurationSourceList(); | |||||
| $config_list = $source_list->getStorageValueList('history.immutable'); | |||||
| if (!$config_list) { | |||||
| return; | |||||
| } | |||||
| $config_value = (bool)last($config_list)->getValue(); | |||||
| if (!$config_value) { | |||||
| return; | |||||
| } | |||||
| // We're in trouble: we would previously have selected "merge" and will | |||||
| // now select "squash". Make sure the user knows what they're in for. | |||||
| echo tsprintf( | |||||
| "\n%!\n%W\n\n", | |||||
| pht('MERGE STRATEGY IS AMBIGUOUS'), | |||||
| pht( | |||||
| 'See <%s>. The default merge strategy under Git with '. | |||||
| '"history.immutable" has changed from "merge" to "squash". Your '. | |||||
| 'configuration is ambiguous under this behavioral change. '. | |||||
| '(Use "--strategy" or configure "arc.land.strategy" to bypass '. | |||||
| 'this check.)', | |||||
| 'https://secure.phabricator.com/T13547')); | |||||
| throw new PhutilArgumentUsageException( | |||||
| pht( | |||||
| 'Desired merge strategy is ambiguous, choose an explicit strategy.')); | |||||
| } | |||||
| } | } | ||||
This comment has a TODO.