[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/differential/config/ -> PhabricatorDifferentialConfigOptions.php (source)

   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 getOptions() {
  15      $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
  16  
  17      $fields = array(
  18        new DifferentialTitleField(),
  19        new DifferentialSummaryField(),
  20        new DifferentialTestPlanField(),
  21        new DifferentialAuthorField(),
  22        new DifferentialReviewersField(),
  23        new DifferentialProjectReviewersField(),
  24        new DifferentialReviewedByField(),
  25        new DifferentialSubscribersField(),
  26        new DifferentialRepositoryField(),
  27        new DifferentialLintField(),
  28        new DifferentialProjectsField(),
  29        new DifferentialUnitField(),
  30        new DifferentialViewPolicyField(),
  31        new DifferentialEditPolicyField(),
  32  
  33        new DifferentialDependsOnField(),
  34        new DifferentialDependenciesField(),
  35        new DifferentialManiphestTasksField(),
  36        new DifferentialCommitsField(),
  37  
  38        new DifferentialJIRAIssuesField(),
  39        new DifferentialAsanaRepresentationField(),
  40  
  41        new DifferentialChangesSinceLastUpdateField(),
  42        new DifferentialBranchField(),
  43  
  44        new DifferentialBlameRevisionField(),
  45        new DifferentialPathField(),
  46        new DifferentialHostField(),
  47        new DifferentialRevertPlanField(),
  48  
  49        new DifferentialApplyPatchField(),
  50  
  51        new DifferentialRevisionIDField(),
  52      );
  53  
  54      $default_fields = array();
  55      foreach ($fields as $field) {
  56        $default_fields[$field->getFieldKey()] = array(
  57          'disabled' => $field->shouldDisableByDefault(),
  58        );
  59      }
  60  
  61      return array(
  62        $this->newOption(
  63          'differential.fields',
  64          $custom_field_type,
  65          $default_fields)
  66          ->setCustomData(
  67            id(new DifferentialRevision())->getCustomFieldBaseClass())
  68          ->setDescription(
  69            pht(
  70              "Select and reorder revision fields.\n\n".
  71              "NOTE: This feature is under active development and subject ".
  72              "to change.")),
  73        $this->newOption(
  74          'differential.whitespace-matters',
  75          'list<regex>',
  76          array(
  77            '/\.py$/',
  78            '/\.l?hs$/',
  79          ))
  80          ->setDescription(
  81            pht(
  82              "List of file regexps where whitespace is meaningful and should ".
  83              "not use 'ignore-all' by default")),
  84        $this->newOption('differential.require-test-plan-field', 'bool', true)
  85          ->setBoolOptions(
  86            array(
  87              pht("Require 'Test Plan' field"),
  88              pht("Make 'Test Plan' field optional"),
  89            ))
  90          ->setSummary(pht('Require "Test Plan" field?'))
  91          ->setDescription(
  92            pht(
  93              "Differential has a required 'Test Plan' field by default. You ".
  94              "can make it optional by setting this to false. You can also ".
  95              "completely remove it above, if you prefer.")),
  96        $this->newOption('differential.enable-email-accept', 'bool', false)
  97          ->setBoolOptions(
  98            array(
  99              pht('Enable Email "!accept" Action'),
 100              pht('Disable Email "!accept" Action'),
 101            ))
 102          ->setSummary(pht('Enable or disable "!accept" action via email.'))
 103          ->setDescription(
 104            pht(
 105              'If inbound email is configured, users can interact with '.
 106              'revisions by using "!actions" in email replies (for example, '.
 107              '"!resign" or "!rethink"). However, by default, users may not '.
 108              '"!accept" revisions via email: email authentication can be '.
 109              'configured to be very weak, and email "!accept" is kind of '.
 110              'sketchy and implies the revision may not actually be receiving '.
 111              'thorough review. You can enable "!accept" by setting this '.
 112              'option to true.')),
 113        $this->newOption('differential.generated-paths', 'list<regex>', array())
 114          ->setSummary(pht('File regexps to treat as automatically generated.'))
 115          ->setDescription(
 116            pht(
 117              'List of file regexps that should be treated as if they are '.
 118              'generated by an automatic process, and thus get hidden by '.
 119              'default in differential.'))
 120          ->addExample("/config\.h$/\n#/autobuilt/#", pht('Valid Setting')),
 121        $this->newOption('differential.sticky-accept', 'bool', true)
 122          ->setBoolOptions(
 123            array(
 124              pht('Accepts persist across updates'),
 125              pht('Accepts are reset by updates'),
 126            ))
 127          ->setSummary(
 128            pht('Should "Accepted" revisions remain "Accepted" after updates?'))
 129          ->setDescription(
 130            pht(
 131              'Normally, when revisions that have been "Accepted" are updated, '.
 132              'they remain "Accepted". This allows reviewers to suggest minor '.
 133              'alterations when accepting, and encourages authors to update '.
 134              'if they make minor changes in response to this feedback.'.
 135              "\n\n".
 136              'If you want updates to always require re-review, you can disable '.
 137              'the "stickiness" of the "Accepted" status with this option. '.
 138              'This may make the process for minor changes much more burdensome '.
 139              'to both authors and reviewers.')),
 140        $this->newOption('differential.allow-self-accept', 'bool', false)
 141          ->setBoolOptions(
 142            array(
 143              pht('Allow self-accept'),
 144              pht('Disallow self-accept'),
 145            ))
 146          ->setSummary(pht('Allows users to accept their own revisions.'))
 147          ->setDescription(
 148            pht(
 149              "If you set this to true, users can accept their own revisions. ".
 150              "This action is disabled by default because it's most likely not ".
 151              "a behavior you want, but it proves useful if you are working ".
 152              "alone on a project and want to make use of all of ".
 153              "differential's features.")),
 154        $this->newOption('differential.always-allow-close', 'bool', false)
 155          ->setBoolOptions(
 156            array(
 157              pht('Allow any user'),
 158              pht('Restrict to submitter'),
 159            ))
 160          ->setSummary(pht('Allows any user to close accepted revisions.'))
 161          ->setDescription(
 162            pht(
 163              'If you set this to true, any user can close any revision so '.
 164              'long as it has been accepted. This can be useful depending on '.
 165              'your development model. For example, github-style pull requests '.
 166              'where the reviewer is often the actual committer can benefit '.
 167              'from turning this option to true. If false, only the submitter '.
 168              'can close a revision.')),
 169        $this->newOption('differential.always-allow-abandon', 'bool', false)
 170          ->setBoolOptions(
 171            array(
 172              pht('Allow any user'),
 173              pht('Restrict to submitter'),
 174            ))
 175          ->setSummary(pht('Allows any user to abandon revisions.'))
 176          ->setDescription(
 177            pht(
 178              'If you set this to true, any user can abandon any revision. If '.
 179              'false, only the submitter can abandon a revision.')),
 180        $this->newOption('differential.allow-reopen', 'bool', false)
 181          ->setBoolOptions(
 182            array(
 183              pht('Enable reopen'),
 184              pht('Disable reopen'),
 185            ))
 186          ->setSummary(pht('Allows any user to reopen a closed revision.'))
 187          ->setDescription(
 188            pht('If you set this to true, any user can reopen a revision so '.
 189                'long as it has been closed. This can be useful if a revision '.
 190                'is accidentally closed or if a developer changes his or her '.
 191                'mind after closing a revision. If it is false, reopening '.
 192                'is not allowed.')),
 193        $this->newOption('differential.close-on-accept', 'bool', false)
 194          ->setBoolOptions(
 195            array(
 196              pht('Treat Accepted Revisions as "Closed"'),
 197              pht('Treat Accepted Revisions as "Open"'),
 198            ))
 199          ->setSummary(pht('Allows "Accepted" to act as a closed status.'))
 200          ->setDescription(
 201            pht(
 202              'Normally, Differential revisions remain on the dashboard when '.
 203              'they are "Accepted", and the author then commits the changes '.
 204              'to "Close" the revision and move it off the dashboard.'.
 205              "\n\n".
 206              'If you have an unusual workflow where Differential is used for '.
 207              'post-commit review (normally called "Audit", elsewhere in '.
 208              'Phabricator), you can set this flag to treat the "Accepted" '.
 209              'state as a "Closed" state and end the review workflow early.'.
 210              "\n\n".
 211              'This sort of workflow is very unusual. Very few installs should '.
 212              'need to change this option.')),
 213        $this->newOption('differential.days-fresh', 'int', 1)
 214          ->setSummary(
 215            pht(
 216              "For how many business days should a revision be considered ".
 217              "'fresh'?"))
 218          ->setDescription(
 219            pht(
 220              'Revisions newer than this number of days are marked as fresh in '.
 221              'Action Required and Revisions Waiting on You views. Only work '.
 222              'days (not weekends and holidays) are included. Set to 0 to '.
 223              'disable this feature.')),
 224        $this->newOption('differential.days-stale', 'int', 3)
 225          ->setSummary(
 226            pht("After this many days, a revision will be considered 'stale'."))
 227          ->setDescription(
 228            pht(
 229              "Similar to `differential.days-fresh` but marks stale revisions. ".
 230              "If the revision is even older than it is when marked as 'old'.")),
 231        $this->newOption(
 232          'metamta.differential.reply-handler-domain',
 233          'string',
 234          null)
 235          ->setDescription(
 236            pht('Inbound email domain for Differential replies.')),
 237        $this->newOption(
 238          'metamta.differential.reply-handler',
 239          'class',
 240          'DifferentialReplyHandler')
 241          ->setBaseClass('PhabricatorMailReplyHandler')
 242          ->setDescription(pht('Alternate reply handler class.')),
 243        $this->newOption(
 244          'metamta.differential.subject-prefix',
 245          'string',
 246          '[Differential]')
 247          ->setDescription(pht('Subject prefix for Differential mail.')),
 248        $this->newOption(
 249          'metamta.differential.attach-patches',
 250          'bool',
 251          false)
 252          ->setBoolOptions(
 253            array(
 254              pht('Attach Patches'),
 255              pht('Do Not Attach Patches'),
 256            ))
 257          ->setSummary(pht('Attach patches to email, as text attachments.'))
 258          ->setDescription(
 259            pht(
 260              'If you set this to true, Phabricator will attach patches to '.
 261              'Differential mail (as text attachments). This will not work if '.
 262              'you are using SendGrid as your mail adapter.')),
 263        $this->newOption(
 264          'metamta.differential.inline-patches',
 265          'int',
 266          0)
 267          ->setSummary(pht('Inline patches in email, as body text.'))
 268          ->setDescription(
 269            pht(
 270              "To include patches inline in email bodies, set this to a ".
 271              "positive integer. Patches will be inlined if they are at most ".
 272              "that many lines. For instance, a value of 100 means 'inline ".
 273              "patches if they are no longer than 100 lines'. By default, ".
 274              "patches are not inlined.")),
 275        // TODO: Implement 'enum'? Options are 'unified' or 'git'.
 276        $this->newOption(
 277          'metamta.differential.patch-format',
 278          'string',
 279          'unified')
 280          ->setDescription(
 281            pht("Format for inlined or attached patches: 'git' or 'unified'.")),
 282        $this->newOption(
 283          'metamta.differential.unified-comment-context',
 284          'bool',
 285          false)
 286          ->setBoolOptions(
 287            array(
 288              pht('Show context'),
 289              pht('Do not show context'),
 290            ))
 291          ->setSummary(pht('Show diff context around inline comments in email.'))
 292          ->setDescription(
 293            pht(
 294              'Normally, inline comments in emails are shown with a file and '.
 295              'line but without any diff context. Enabling this option adds '.
 296              'diff context and the comment thread.')),
 297      );
 298    }
 299  
 300  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1