Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistDiffWorkflow.php
| Show First 20 Lines • Show All 2,011 Lines • ▼ Show 20 Lines | private function parseCommitMessagesIntoFields(array $local) { | ||||
| $faux_message = array(); | $faux_message = array(); | ||||
| if ($this->getArgument('reviewers')) { | if ($this->getArgument('reviewers')) { | ||||
| $faux_message[] = pht('Reviewers: %s', $this->getArgument('reviewers')); | $faux_message[] = pht('Reviewers: %s', $this->getArgument('reviewers')); | ||||
| } | } | ||||
| if ($this->getArgument('cc')) { | if ($this->getArgument('cc')) { | ||||
| $faux_message[] = pht('CC: %s', $this->getArgument('cc')); | $faux_message[] = pht('CC: %s', $this->getArgument('cc')); | ||||
| } | } | ||||
| // NOTE: For now, this isn't a real field, so it just ends up as the first | |||||
| // part of the summary. | |||||
| $depends_ref = $this->getDependsOnRevisionRef(); | |||||
| if ($depends_ref) { | |||||
| $faux_message[] = pht( | |||||
| 'Depends on %s. ', | |||||
| $depends_ref->getMonogram()); | |||||
| } | |||||
| // See T12069. After T10312, the first line of a message is always parsed | // See T12069. After T10312, the first line of a message is always parsed | ||||
| // as a title. Add a placeholder so "Reviewers" and "CC" are never the | // as a title. Add a placeholder so "Reviewers" and "CC" are never the | ||||
| // first line. | // first line. | ||||
| $placeholder_title = pht('<placeholder>'); | $placeholder_title = pht('<placeholder>'); | ||||
| if ($faux_message) { | if ($faux_message) { | ||||
| array_unshift($faux_message, $placeholder_title); | array_unshift($faux_message, $placeholder_title); | ||||
| $faux_message = implode("\n\n", $faux_message); | $faux_message = implode("\n\n", $faux_message); | ||||
| ▲ Show 20 Lines • Show All 997 Lines • ▼ Show 20 Lines | private function updateAutotargets($diff_phid, $unit_result) { | ||||
| } catch (Exception $ex) { | } catch (Exception $ex) { | ||||
| // TODO: Eventually, we should expect these to succeed if we get this | // TODO: Eventually, we should expect these to succeed if we get this | ||||
| // far, but just log errors for now. | // far, but just log errors for now. | ||||
| phlog($ex); | phlog($ex); | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| private function getDependsOnRevisionRef() { | |||||
| $api = $this->getRepositoryAPI(); | |||||
| $base_ref = $api->getBaseCommitRef(); | |||||
| $state_ref = $this->newWorkingCopyStateRef() | |||||
| ->setCommitRef($base_ref); | |||||
| $this->newRefQuery(array($state_ref)) | |||||
| ->needHardpoints( | |||||
| array( | |||||
| 'revisionRefs', | |||||
| )) | |||||
| ->execute(); | |||||
| $revision_refs = $state_ref->getRevisionRefs(); | |||||
| $viewer_phid = $this->getUserPHID(); | |||||
| foreach ($revision_refs as $key => $revision_ref) { | |||||
| // Don't automatically depend on closed revisions. | |||||
| if ($revision_ref->isClosed()) { | |||||
| unset($revision_refs[$key]); | |||||
| continue; | |||||
| } | |||||
| // Don't automatically depend on revisions authored by other users. | |||||
| if ($revision_ref->getAuthorPHID() != $viewer_phid) { | |||||
| unset($revision_refs[$key]); | |||||
| continue; | |||||
| } | |||||
| } | |||||
| if (!$revision_refs) { | |||||
| return null; | |||||
| } | |||||
| if (count($revision_refs) > 1) { | |||||
| return null; | |||||
| } | |||||
| return head($revision_refs); | |||||
| } | |||||
| } | } | ||||