Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/parser/DifferentialChangesetParser.php
| Show First 20 Lines • Show All 493 Lines • ▼ Show 20 Lines | $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | ||||
| // not writing it. | // not writing it. | ||||
| // TODO: It would be nice to tailor this more narrowly. | // TODO: It would be nice to tailor this more narrowly. | ||||
| } | } | ||||
| unset($unguarded); | unset($unguarded); | ||||
| } | } | ||||
| private function markGenerated($new_corpus_block = '') { | private function markGenerated($new_corpus_block = '') { | ||||
| $generated_guess = (strpos($new_corpus_block, '@'.'generated') !== false); | $generated = (strpos($new_corpus_block, '@'.'generated') !== false); | ||||
| if (!$generated_guess) { | if (!$generated) { | ||||
| foreach ($this->generatedPaths as $regex) { | foreach ($this->generatedPaths as $regex) { | ||||
| if (preg_match($regex, $this->changeset->getFilename())) { | if (preg_match($regex, $this->changeset->getFilename())) { | ||||
| $generated_guess = true; | $generated = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| // The following is deprecated and should not be used. | |||||
| if (!$generated_guess) { | |||||
| $key = 'differential.generated-paths'; | |||||
| $generated_path_regexps = PhabricatorEnv::getEnvConfig($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( | |||||
| 'corpus' => $new_corpus_block, | |||||
| 'is_generated' => $generated_guess, | |||||
| ) | |||||
| ); | |||||
| PhutilEventEngine::dispatchEvent($event); | |||||
| $generated = $event->getValue('is_generated'); | |||||
| $this->specialAttributes[self::ATTR_GENERATED] = $generated; | $this->specialAttributes[self::ATTR_GENERATED] = $generated; | ||||
| } | } | ||||
| public function isGenerated() { | public function isGenerated() { | ||||
| return idx($this->specialAttributes, self::ATTR_GENERATED, false); | return idx($this->specialAttributes, self::ATTR_GENERATED, false); | ||||
| } | } | ||||
| public function isDeleted() { | public function isDeleted() { | ||||
| ▲ Show 20 Lines • Show All 1,046 Lines • Show Last 20 Lines | |||||