4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,12 @@ protected function execute(ConduitAPIRequest $request) {
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,6 +128,26 @@ protected function execute(ConduitAPIRequest $request) {
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 ;
Original file line number Diff line number Diff line change @@ -47,4 +47,11 @@ public function getKeyForConduit() {
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
}
Original file line number Diff line number Diff line change @@ -667,6 +667,10 @@ public function didParseCommit(
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
Original file line number Diff line number Diff line change @@ -173,4 +173,11 @@ public function renderValueForMail($phase) {
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
}
0 commit comments