Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistDiffWorkflow.php
| Show First 20 Lines • Show All 525 Lines • ▼ Show 20 Lines | if ($phid) { | ||||
| $this->hitAutotargets = $this->updateAutotargets( | $this->hitAutotargets = $this->updateAutotargets( | ||||
| $phid, | $phid, | ||||
| $unit_result); | $unit_result); | ||||
| } | } | ||||
| $this->updateLintDiffProperty(); | $this->updateLintDiffProperty(); | ||||
| $this->updateUnitDiffProperty(); | $this->updateUnitDiffProperty(); | ||||
| $this->updateLocalDiffProperty(); | $this->updateLocalDiffProperty(); | ||||
| $this->updateOntoDiffProperty(); | |||||
| $this->resolveDiffPropertyUpdates(); | $this->resolveDiffPropertyUpdates(); | ||||
| $output_json = $this->getArgument('json'); | $output_json = $this->getArgument('json'); | ||||
| if ($this->shouldOnlyCreateDiff()) { | if ($this->shouldOnlyCreateDiff()) { | ||||
| if (!$output_json) { | if (!$output_json) { | ||||
| echo phutil_console_format( | echo phutil_console_format( | ||||
| "%s\n **%s** __%s__\n\n", | "%s\n **%s** __%s__\n\n", | ||||
| ▲ Show 20 Lines • Show All 1,859 Lines • ▼ Show 20 Lines | private function updateLocalDiffProperty() { | ||||
| $local_info = $this->getRepositoryAPI()->getLocalCommitInformation(); | $local_info = $this->getRepositoryAPI()->getLocalCommitInformation(); | ||||
| if (!$local_info) { | if (!$local_info) { | ||||
| return; | return; | ||||
| } | } | ||||
| $this->updateDiffProperty('local:commits', json_encode($local_info)); | $this->updateDiffProperty('local:commits', json_encode($local_info)); | ||||
| } | } | ||||
| private function updateOntoDiffProperty() { | |||||
| $onto = $this->getDiffOntoTargets(); | |||||
| if (!$onto) { | |||||
| return; | |||||
| } | |||||
| $this->updateDiffProperty('arc:onto', json_encode($onto)); | |||||
| } | |||||
| private function getDiffOntoTargets() { | |||||
| $api = $this->getRepositoryAPI(); | |||||
| if (!($api instanceof ArcanistGitAPI)) { | |||||
| return null; | |||||
| } | |||||
| // If we track an upstream branch either directly or indirectly, use that. | |||||
| $branch = $api->getBranchName(); | |||||
| if (strlen($branch)) { | |||||
| $upstream_path = $api->getPathToUpstream($branch); | |||||
| $remote_branch = $upstream_path->getRemoteBranchName(); | |||||
| if (strlen($remote_branch)) { | |||||
| return array( | |||||
| array( | |||||
| 'type' => 'branch', | |||||
| 'name' => $remote_branch, | |||||
| 'kind' => 'upstream', | |||||
| ), | |||||
| ); | |||||
| } | |||||
| } | |||||
| // If "arc.land.onto.default" is configured, use that. | |||||
| $config_key = 'arc.land.onto.default'; | |||||
| $onto = $this->getConfigFromAnySource($config_key); | |||||
| if (strlen($onto)) { | |||||
| return array( | |||||
| array( | |||||
| 'type' => 'branch', | |||||
| 'name' => $onto, | |||||
| 'kind' => 'arc.land.onto.default', | |||||
| ), | |||||
| ); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | /** | ||||
| * Update an arbitrary diff property. | * Update an arbitrary diff property. | ||||
| * | * | ||||
| * @param string Diff property name. | * @param string Diff property name. | ||||
| * @param string Diff property value. | * @param string Diff property value. | ||||
| * @return void | * @return void | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 364 Lines • Show Last 20 Lines | |||||