Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
12256 views
1
<?php
2
3
final class PhabricatorDifferentialConfigOptions
4
extends PhabricatorApplicationConfigOptions {
5
6
public function getName() {
7
return pht('Differential');
8
}
9
10
public function getDescription() {
11
return pht('Configure Differential code review.');
12
}
13
14
public function getIcon() {
15
return 'fa-cog';
16
}
17
18
public function getGroup() {
19
return 'apps';
20
}
21
22
public function getOptions() {
23
$caches_href = PhabricatorEnv::getDoclink('Managing Caches');
24
25
$custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
26
27
$fields = array(
28
new DifferentialSummaryField(),
29
new DifferentialTestPlanField(),
30
new DifferentialReviewersField(),
31
new DifferentialProjectReviewersField(),
32
new DifferentialRepositoryField(),
33
34
new DifferentialManiphestTasksField(),
35
new DifferentialCommitsField(),
36
37
new DifferentialJIRAIssuesField(),
38
new DifferentialAsanaRepresentationField(),
39
40
new DifferentialChangesSinceLastUpdateField(),
41
new DifferentialBranchField(),
42
43
new DifferentialBlameRevisionField(),
44
new DifferentialPathField(),
45
new DifferentialHostField(),
46
new DifferentialLintField(),
47
new DifferentialUnitField(),
48
new DifferentialRevertPlanField(),
49
);
50
51
$default_fields = array();
52
foreach ($fields as $field) {
53
$default_fields[$field->getFieldKey()] = array(
54
'disabled' => $field->shouldDisableByDefault(),
55
);
56
}
57
58
$inline_description = $this->deformat(
59
pht(<<<EOHELP
60
To include patches inline in email bodies, set this option to a positive
61
integer. Patches will be inlined if they are at most that many lines and at
62
most 256 times that many bytes.
63
64
For example, a value of 100 means "inline patches if they are at not more than
65
100 lines long and not more than 25,600 bytes large".
66
67
By default, patches are not inlined.
68
EOHELP
69
));
70
71
return array(
72
$this->newOption(
73
'differential.fields',
74
$custom_field_type,
75
$default_fields)
76
->setCustomData(
77
id(new DifferentialRevision())->getCustomFieldBaseClass())
78
->setDescription(
79
pht(
80
"Select and reorder revision fields.\n\n".
81
"NOTE: This feature is under active development and subject ".
82
"to change.")),
83
$this->newOption('differential.require-test-plan-field', 'bool', true)
84
->setBoolOptions(
85
array(
86
pht("Require 'Test Plan' field"),
87
pht("Make 'Test Plan' field optional"),
88
))
89
->setSummary(pht('Require "Test Plan" field?'))
90
->setDescription(
91
pht(
92
"Differential has a required 'Test Plan' field by default. You ".
93
"can make it optional by setting this to false. You can also ".
94
"completely remove it above, if you prefer.")),
95
$this->newOption('differential.enable-email-accept', 'bool', false)
96
->setBoolOptions(
97
array(
98
pht('Enable Email "!accept" Action'),
99
pht('Disable Email "!accept" Action'),
100
))
101
->setSummary(pht('Enable or disable "!accept" action via email.'))
102
->setDescription(
103
pht(
104
'If inbound email is configured, users can interact with '.
105
'revisions by using "!actions" in email replies (for example, '.
106
'"!resign" or "!rethink"). However, by default, users may not '.
107
'"!accept" revisions via email: email authentication can be '.
108
'configured to be very weak, and email "!accept" is kind of '.
109
'sketchy and implies the revision may not actually be receiving '.
110
'thorough review. You can enable "!accept" by setting this '.
111
'option to true.')),
112
$this->newOption('differential.generated-paths', 'list<regex>', array())
113
->setSummary(pht('File regexps to treat as automatically generated.'))
114
->setDescription(
115
pht(
116
'List of file regexps that should be treated as if they are '.
117
'generated by an automatic process, and thus be hidden by '.
118
'default in Differential.'.
119
"\n\n".
120
'NOTE: This property is cached, so you will need to purge the '.
121
'cache after making changes if you want the new configuration '.
122
'to affect existing revisions. For instructions, see '.
123
'**[[ %s | Managing Caches ]]** in the documentation.',
124
$caches_href))
125
->addExample("/config\.h$/\n#(^|/)autobuilt/#", pht('Valid Setting')),
126
$this->newOption('differential.sticky-accept', 'bool', true)
127
->setBoolOptions(
128
array(
129
pht('Accepts persist across updates'),
130
pht('Accepts are reset by updates'),
131
))
132
->setSummary(
133
pht('Should "Accepted" revisions remain "Accepted" after updates?'))
134
->setDescription(
135
pht(
136
'Normally, when revisions that have been "Accepted" are updated, '.
137
'they remain "Accepted". This allows reviewers to suggest minor '.
138
'alterations when accepting, and encourages authors to update '.
139
'if they make minor changes in response to this feedback.'.
140
"\n\n".
141
'If you want updates to always require re-review, you can disable '.
142
'the "stickiness" of the "Accepted" status with this option. '.
143
'This may make the process for minor changes much more burdensome '.
144
'to both authors and reviewers.')),
145
$this->newOption('differential.allow-self-accept', 'bool', false)
146
->setBoolOptions(
147
array(
148
pht('Allow self-accept'),
149
pht('Disallow self-accept'),
150
))
151
->setSummary(pht('Allows users to accept their own revisions.'))
152
->setDescription(
153
pht(
154
"If you set this to true, users can accept their own revisions. ".
155
"This action is disabled by default because it's most likely not ".
156
"a behavior you want, but it proves useful if you are working ".
157
"alone on a project and want to make use of all of ".
158
"differential's features.")),
159
$this->newOption('differential.always-allow-close', 'bool', false)
160
->setBoolOptions(
161
array(
162
pht('Allow any user'),
163
pht('Restrict to submitter'),
164
))
165
->setSummary(pht('Allows any user to close accepted revisions.'))
166
->setDescription(
167
pht(
168
'If you set this to true, any user can close any revision so '.
169
'long as it has been accepted. This can be useful depending on '.
170
'your development model. For example, github-style pull requests '.
171
'where the reviewer is often the actual committer can benefit '.
172
'from turning this option to true. If false, only the submitter '.
173
'can close a revision.')),
174
$this->newOption('differential.always-allow-abandon', 'bool', false)
175
->setBoolOptions(
176
array(
177
pht('Allow any user'),
178
pht('Restrict to submitter'),
179
))
180
->setSummary(pht('Allows any user to abandon revisions.'))
181
->setDescription(
182
pht(
183
'If you set this to true, any user can abandon any revision. If '.
184
'false, only the submitter can abandon a revision.')),
185
$this->newOption('differential.allow-reopen', 'bool', false)
186
->setBoolOptions(
187
array(
188
pht('Enable reopen'),
189
pht('Disable reopen'),
190
))
191
->setSummary(pht('Allows any user to reopen a closed revision.'))
192
->setDescription(
193
pht(
194
'If you set this to true, any user can reopen a revision so '.
195
'long as it has been closed. This can be useful if a revision '.
196
'is accidentally closed or if a developer changes his or her '.
197
'mind after closing a revision. If it is false, reopening '.
198
'is not allowed.')),
199
$this->newOption('differential.close-on-accept', 'bool', false)
200
->setBoolOptions(
201
array(
202
pht('Treat Accepted Revisions as "Closed"'),
203
pht('Treat Accepted Revisions as "Open"'),
204
))
205
->setSummary(pht('Allows "Accepted" to act as a closed status.'))
206
->setDescription(
207
pht(
208
'Normally, Differential revisions remain on the dashboard when '.
209
'they are "Accepted", and the author then commits the changes '.
210
'to "Close" the revision and move it off the dashboard.'.
211
"\n\n".
212
'If you have an unusual workflow where Differential is used for '.
213
'post-commit review (normally called "Audit", elsewhere), you '.
214
'can set this flag to treat the "Accepted" '.
215
'state as a "Closed" state and end the review workflow early.'.
216
"\n\n".
217
'This sort of workflow is very unusual. Very few installs should '.
218
'need to change this option.')),
219
$this->newOption(
220
'metamta.differential.attach-patches',
221
'bool',
222
false)
223
->setBoolOptions(
224
array(
225
pht('Attach Patches'),
226
pht('Do Not Attach Patches'),
227
))
228
->setSummary(pht('Attach patches to email, as text attachments.'))
229
->setDescription(
230
pht(
231
'If you set this to true, patches will be attached to '.
232
'Differential mail (as text attachments). This will not work if '.
233
'you are using SendGrid as your mail adapter.')),
234
$this->newOption(
235
'metamta.differential.inline-patches',
236
'int',
237
0)
238
->setSummary(pht('Inline patches in email, as body text.'))
239
->setDescription($inline_description),
240
$this->newOption(
241
'metamta.differential.patch-format',
242
'enum',
243
'unified')
244
->setDescription(
245
pht('Format for inlined or attached patches.'))
246
->setEnumOptions(
247
array(
248
'unified' => pht('Unified'),
249
'git' => pht('Git'),
250
)),
251
);
252
}
253
254
}
255
256