Page MenuHomePhabricator

D19433.id46484.diff
No OneTemporary

D19433.id46484.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2525,6 +2525,7 @@
'PhabricatorChatLogDAO' => 'applications/chatlog/storage/PhabricatorChatLogDAO.php',
'PhabricatorChatLogEvent' => 'applications/chatlog/storage/PhabricatorChatLogEvent.php',
'PhabricatorChatLogQuery' => 'applications/chatlog/query/PhabricatorChatLogQuery.php',
+ 'PhabricatorCheckboxesEditField' => 'applications/transactions/editfield/PhabricatorCheckboxesEditField.php',
'PhabricatorChunkedFileStorageEngine' => 'applications/files/engine/PhabricatorChunkedFileStorageEngine.php',
'PhabricatorClassConfigType' => 'applications/config/type/PhabricatorClassConfigType.php',
'PhabricatorClusterConfigOptions' => 'applications/config/option/PhabricatorClusterConfigOptions.php',
@@ -8140,6 +8141,7 @@
'PhabricatorPolicyInterface',
),
'PhabricatorChatLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'PhabricatorCheckboxesEditField' => 'PhabricatorEditField',
'PhabricatorChunkedFileStorageEngine' => 'PhabricatorFileStorageEngine',
'PhabricatorClassConfigType' => 'PhabricatorTextConfigType',
'PhabricatorClusterConfigOptions' => 'PhabricatorApplicationConfigOptions',
diff --git a/src/applications/owners/editor/PhabricatorOwnersPackageEditEngine.php b/src/applications/owners/editor/PhabricatorOwnersPackageEditEngine.php
--- a/src/applications/owners/editor/PhabricatorOwnersPackageEditEngine.php
+++ b/src/applications/owners/editor/PhabricatorOwnersPackageEditEngine.php
@@ -162,13 +162,17 @@
->setIsConduitOnly(true)
->setValue($object->getStatus())
->setOptions($object->getStatusNameMap()),
- id(new PhabricatorStringListEditField())
+ id(new PhabricatorCheckboxesEditField())
->setKey('ignored')
->setLabel(pht('Ignored Attributes'))
->setDescription(pht('Ignore paths with any of these attributes.'))
->setTransactionType(
PhabricatorOwnersPackageIgnoredTransaction::TRANSACTIONTYPE)
- ->setValue(array_keys($object->getIgnoredPathAttributes())),
+ ->setValue(array_keys($object->getIgnoredPathAttributes()))
+ ->setOptions(
+ array(
+ 'generated' => pht('Ignore generated files (review only).'),
+ )),
id(new PhabricatorConduitEditField())
->setKey('paths.set')
->setLabel(pht('Paths'))
diff --git a/src/applications/transactions/editfield/PhabricatorCheckboxesEditField.php b/src/applications/transactions/editfield/PhabricatorCheckboxesEditField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/transactions/editfield/PhabricatorCheckboxesEditField.php
@@ -0,0 +1,36 @@
+<?php
+
+final class PhabricatorCheckboxesEditField
+ extends PhabricatorEditField {
+
+ private $options;
+
+ protected function newControl() {
+ $options = $this->getOptions();
+
+ return id(new AphrontFormCheckboxControl())
+ ->setOptions($options);
+ }
+
+ protected function newConduitParameterType() {
+ return new ConduitStringListParameterType();
+ }
+
+ protected function newHTTPParameterType() {
+ return new AphrontStringListHTTPParameterType();
+ }
+
+ public function setOptions(array $options) {
+ $this->options = $options;
+ return $this;
+ }
+
+ public function getOptions() {
+ if ($this->options === null) {
+ throw new PhutilInvalidStateException('setOptions');
+ }
+
+ return $this->options;
+ }
+
+}
diff --git a/src/docs/user/userguide/owners.diviner b/src/docs/user/userguide/owners.diviner
--- a/src/docs/user/userguide/owners.diviner
+++ b/src/docs/user/userguide/owners.diviner
@@ -132,6 +132,21 @@
write more sophisticated rules.
+Ignored Attributes
+==================
+
+You can automatically exclude certain types of files, like generated files,
+with **Ignored Attributes**.
+
+When a package is marked as ignoring files with a particular attribute, and
+a file in a particular change has that attribute, the file will be ignored when
+computing ownership.
+
+(This feature is currently rough, only works for Differential revisions, and
+may not always compute the correct set of owning packages in some complex
+cases where it interacts with dominion rules.)
+
+
Files in Multiple Packages
==========================
diff --git a/src/view/form/control/AphrontFormCheckboxControl.php b/src/view/form/control/AphrontFormCheckboxControl.php
--- a/src/view/form/control/AphrontFormCheckboxControl.php
+++ b/src/view/form/control/AphrontFormCheckboxControl.php
@@ -34,6 +34,20 @@
return 'aphront-form-control-checkbox';
}
+ public function setOptions(array $options) {
+ $boxes = array();
+ foreach ($options as $key => $value) {
+ $boxes[] = array(
+ 'value' => $key,
+ 'label' => $value,
+ );
+ }
+
+ $this->boxes = $boxes;
+
+ return $this;
+ }
+
protected function renderInput() {
$rows = array();
foreach ($this->boxes as $box) {
@@ -41,14 +55,28 @@
if ($id === null) {
$id = celerity_generate_unique_node_id();
}
+
+ $name = idx($box, 'name');
+ if ($name === null) {
+ $name = $this->getName().'[]';
+ }
+
+ $value = $box['value'];
+
+ if (array_key_exists('checked', $box)) {
+ $checked = $box['checked'];
+ } else {
+ $checked = in_array($value, $this->getValue());
+ }
+
$checkbox = phutil_tag(
'input',
array(
'id' => $id,
'type' => 'checkbox',
- 'name' => $box['name'],
+ 'name' => $name,
'value' => $box['value'],
- 'checked' => $box['checked'] ? 'checked' : null,
+ 'checked' => $checked ? 'checked' : null,
'disabled' => $this->getDisabled() ? 'disabled' : null,
));
$label = phutil_tag(

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 30, 12:11 AM (2 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7398174
Default Alt Text
D19433.id46484.diff (5 KB)

Event Timeline