1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Allow customized patterns for marking generated files.

Test Plan:
Created a listener that adds some patterns to $matches array, reloaded
Differential, some changesets were not shown as generated.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley, mareksapota

Differential Revision: 1200
This commit is contained in:
Marek Sapota 2011-12-13 17:13:09 -08:00
parent 6dab49c6ff
commit 2d232674df
4 changed files with 26 additions and 2 deletions

View file

@ -540,7 +540,18 @@ class DifferentialChangesetParser {
ipull($this->intra, 1),
$new_corpus);
$generated = (strpos($new_corpus_block, '@'.'generated') !== false);
$generated_guess = (strpos($new_corpus_block, '@'.'generated') !== false);
$event = new PhabricatorEvent(
PhabricatorEventType::TYPE_DIFFERENTIAL_WILLMARKGENERATED,
array(
'corpus' => $new_corpus_block,
'is_generated' => $generated_guess
)
);
PhutilEventEngine::dispatchEvent($event);
$generated = $event->getValue('is_generated');
$this->specialAttributes[self::ATTR_GENERATED] = $generated;
}

View file

@ -15,10 +15,13 @@ phutil_require_module('phabricator', 'applications/differential/view/inlinecomme
phutil_require_module('phabricator', 'applications/files/uri');
phutil_require_module('phabricator', 'applications/markup/syntax');
phutil_require_module('phabricator', 'infrastructure/diff/engine');
phutil_require_module('phabricator', 'infrastructure/events/constant/type');
phutil_require_module('phabricator', 'infrastructure/events/event');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phabricator', 'storage/queryfx');
phutil_require_module('phutil', 'error');
phutil_require_module('phutil', 'events/engine');
phutil_require_module('phutil', 'future');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');

View file

@ -28,7 +28,16 @@ or alter the edit. Data available on this event:
== PhabricatorEventType::TYPE_DIFFERENTIAL_WILLSENDMAIL ==
This event is dispatche before Differential sends an email, and allows you to
This event is dispatched before Differential sends an email, and allows you to
edit the message that will be sent. Data available on this event:
- ##mail## The {@class:PhabricatorMetaMTAMail} being edited.
== PhabricatorEventType::TYPE_DIFFERENTIAL_WILLMARKGENERATED ==
This event is dispatched before Differential decides if a file is generated (and
doesn't need to be reviewed) or not. Data available on this event:
- ##corpus## Body of the file.
- ##is_generated## Boolean indicating if this file should be treated as
generated.

View file

@ -20,5 +20,6 @@ final class PhabricatorEventType extends PhutilEventType {
const TYPE_MANIPHEST_WILLEDITTASK = 'maniphest.willEditTask';
const TYPE_DIFFERENTIAL_WILLSENDMAIL = 'differential.willSendMail';
const TYPE_DIFFERENTIAL_WILLMARKGENERATED = 'differential.willMarkGenerated';
}