@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adding pro tips to Differential commit message

Summary: Randomly displaying tips about different features of arc.

Test Plan: Will test by running arc diff and seeing if the tips appear in text-based UI of arc

Reviewers: epriestley, AnhNhan

Reviewed By: AnhNhan

CC: aran, Korvin, AnhNhan

Differential Revision: https://secure.phabricator.com/D5351

authored by

Afaque Hussain and committed by
epriestley
d43bcdc1 23ec113a

+41
+23
src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php
··· 48 48 $aux_fields = DifferentialFieldSelector::newSelector() 49 49 ->getFieldSpecifications(); 50 50 51 + $pro_tips = array(); 52 + 51 53 foreach ($aux_fields as $key => $aux_field) { 52 54 $aux_field->setUser($request->getUser()); 53 55 $aux_field->setRevision($revision); 56 + $pro_tips[] = $aux_field->getCommitMessageTips(); 54 57 if (!$aux_field->shouldAppearOnCommitMessage()) { 55 58 unset($aux_fields[$key]); 56 59 } ··· 125 128 } 126 129 } 127 130 } 131 + 132 + if ($is_edit) { 133 + $pro_tips = array_mergev($pro_tips); 134 + 135 + if (!empty($pro_tips)) { 136 + shuffle($pro_tips); 137 + $pro_tip = "Tip: ".$pro_tips[0]; 138 + $pro_tip = wordwrap($pro_tip, 78, "\n", true); 139 + 140 + $lines = explode("\n", $pro_tip); 141 + 142 + foreach ($lines as $key => $line) { 143 + $lines[$key] = "# ".$line; 144 + } 145 + 146 + $pro_tip = implode("\n", $lines); 147 + $commit_message[] = $pro_tip; 148 + } 149 + } 150 + 128 151 $commit_message = implode("\n\n", $commit_message); 129 152 130 153 return $commit_message;
+7
src/applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php
··· 47 47 return 'phabricator:depends-on'; 48 48 } 49 49 50 + public function getCommitMessageTips() { 51 + return array( 52 + 'Use "Depends on D123" in your summary to mark '. 53 + 'a dependency between revisions.' 54 + ); 55 + } 56 + 50 57 }
+4
src/applications/differential/field/specification/DifferentialFieldSpecification.php
··· 667 667 return; 668 668 } 669 669 670 + public function getCommitMessageTips() { 671 + return array(); 672 + } 673 + 670 674 671 675 /* -( Loading Additional Data )-------------------------------------------- */ 672 676
+7
src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php
··· 173 173 return implode("\n", $body); 174 174 } 175 175 176 + public function getCommitMessageTips() { 177 + return array( 178 + 'Use "Fixes T123" in your summary to mark that the current '. 179 + 'revision completes a given task.' 180 + ); 181 + } 182 + 176 183 }