Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistDiffWorkflow.php
| Show First 20 Lines • Show All 387 Lines • ▼ Show 20 Lines | $arguments = array( | ||||
| 'base' => array( | 'base' => array( | ||||
| 'param' => 'rules', | 'param' => 'rules', | ||||
| 'help' => pht('Additional rules for determining base revision.'), | 'help' => pht('Additional rules for determining base revision.'), | ||||
| 'nosupport' => array( | 'nosupport' => array( | ||||
| 'svn' => pht('Subversion does not use base commits.'), | 'svn' => pht('Subversion does not use base commits.'), | ||||
| ), | ), | ||||
| 'supports' => array('git', 'hg'), | 'supports' => array('git', 'hg'), | ||||
| ), | ), | ||||
| 'cache' => array( | |||||
| 'param' => 'bool', | |||||
| 'help' => pht( | |||||
| '%d to disable lint cache, %d to enable (default).', | |||||
| 0, | |||||
| 1), | |||||
| 'passthru' => array( | |||||
| 'lint' => true, | |||||
| ), | |||||
| ), | |||||
| 'coverage' => array( | 'coverage' => array( | ||||
| 'help' => pht('Always enable coverage information.'), | 'help' => pht('Always enable coverage information.'), | ||||
| 'conflicts' => array( | 'conflicts' => array( | ||||
| 'no-coverage' => null, | 'no-coverage' => null, | ||||
| ), | ), | ||||
| 'passthru' => array( | 'passthru' => array( | ||||
| 'unit' => true, | 'unit' => true, | ||||
| ), | ), | ||||
| ▲ Show 20 Lines • Show All 1,531 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 938 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) { | |||||
| continue; | |||||
jmeador: Am I missing something here or should this condition also have the `unset($revision_refs[$key]`… | |||||
Not Done Inline ActionsThanks, D18766. epriestley: Thanks, D18766. | |||||
| } | |||||
amckinleyUnsubmitted Not Done Inline ActionsIs there some tricky reason why this would be a bad thing? Seems like depending on someone else's revision is a reasonable workflow. amckinley: Is there some tricky reason why this would be a bad thing? Seems like depending on someone… | |||||
| } | |||||
| if (!$revision_refs) { | |||||
| return null; | |||||
| } | |||||
| if (count($revision_refs) > 1) { | |||||
| return null; | |||||
| } | |||||
| return head($revision_refs); | |||||
| } | |||||
| } | } | ||||
Am I missing something here or should this condition also have the unset($revision_refs[$key] bit in it?