mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Add support for marking files as "generated" by regexp against path
Summary: Not all auto-generated files can include the magical "generated" annotation for one reason or another, but they may follow path rules. This patch allows files to be marked as automatically generated by matching the path with a regular expression. Test Plan: Alter 'differential.generated-paths' setting in config. Create a new diff that affects a file matching one of those regular expressions. Verify that Differential marks it as automatically generated and therefore probably not worth reviewing (in the same way as the magical "generated" annotation. Reviewers: epriestley CC: aran Differential Revision: https://secure.phabricator.com/D1455
This commit is contained in:
parent
7f9fb3597d
commit
3edf60627d
3 changed files with 19 additions and 0 deletions
|
@ -605,6 +605,13 @@ return array(
|
|||
// interact with the revisions.
|
||||
'differential.anonymous-access' => false,
|
||||
|
||||
// List of file regexps that should be treated as if they are generated by
|
||||
// an automatic process, and thus get hidden by default in differential
|
||||
'differential.generated-paths' => array(
|
||||
// '/config\.h$/',
|
||||
// '#/autobuilt/#',
|
||||
),
|
||||
|
||||
|
||||
// -- Maniphest ------------------------------------------------------------- //
|
||||
|
||||
|
|
|
@ -508,6 +508,17 @@ class DifferentialChangesetParser {
|
|||
|
||||
$generated_guess = (strpos($new_corpus_block, '@'.'generated') !== false);
|
||||
|
||||
if (!$generated_guess) {
|
||||
$config_key = 'differential.generated-paths';
|
||||
$generated_path_regexps = PhabricatorEnv::getEnvConfig($config_key);
|
||||
foreach ($generated_path_regexps as $regexp) {
|
||||
if (preg_match($regexp, $this->changeset->getFilename())) {
|
||||
$generated_guess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$event = new PhabricatorEvent(
|
||||
PhabricatorEventType::TYPE_DIFFERENTIAL_WILLMARKGENERATED,
|
||||
array(
|
||||
|
|
|
@ -15,6 +15,7 @@ phutil_require_module('phabricator', 'applications/differential/view/inlinecomme
|
|||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/markup/syntax');
|
||||
phutil_require_module('phabricator', 'infrastructure/diff/engine');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'infrastructure/events/constant/type');
|
||||
phutil_require_module('phabricator', 'infrastructure/events/event');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||
|
|
Loading…
Reference in a new issue