Differential D19426 Diff 46467 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
| <?php | <?php | ||||
| final class DifferentialTransactionEditor | final class DifferentialTransactionEditor | ||||
| extends PhabricatorApplicationTransactionEditor { | extends PhabricatorApplicationTransactionEditor { | ||||
| private $changedPriorToCommitURI; | private $changedPriorToCommitURI; | ||||
| private $isCloseByCommit; | private $isCloseByCommit; | ||||
| private $repositoryPHIDOverride = false; | private $repositoryPHIDOverride = false; | ||||
| private $didExpandInlineState = false; | private $didExpandInlineState = false; | ||||
| private $affectedPaths; | |||||
| private $firstBroadcast = false; | private $firstBroadcast = false; | ||||
| private $wasBroadcasting; | private $wasBroadcasting; | ||||
| private $isDraftDemotion; | private $isDraftDemotion; | ||||
| private $ownersDiff; | |||||
| private $ownersChangesets; | |||||
| public function getEditorApplicationClass() { | public function getEditorApplicationClass() { | ||||
| return 'PhabricatorDifferentialApplication'; | return 'PhabricatorDifferentialApplication'; | ||||
| } | } | ||||
| public function getEditorObjectsDescription() { | public function getEditorObjectsDescription() { | ||||
| return pht('Differential Revisions'); | return pht('Differential Revisions'); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 940 Lines • ▼ Show 20 Lines | protected function didApplyHeraldRules( | ||||
| HeraldAdapter $adapter, | HeraldAdapter $adapter, | ||||
| HeraldTranscript $transcript) { | HeraldTranscript $transcript) { | ||||
| $repository = $object->getRepository(); | $repository = $object->getRepository(); | ||||
| if (!$repository) { | if (!$repository) { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| if (!$this->affectedPaths) { | $diff = $this->ownersDiff; | ||||
| $changesets = $this->ownersChangesets; | |||||
| $this->ownersDiff = null; | |||||
| $this->ownersChangesets = null; | |||||
| if (!$changesets) { | |||||
| return array(); | return array(); | ||||
| } | } | ||||
| $packages = PhabricatorOwnersPackage::loadAffectedPackages( | $packages = PhabricatorOwnersPackage::loadAffectedPackagesForChangesets( | ||||
| $repository, | $repository, | ||||
| $this->affectedPaths); | $diff, | ||||
| $changesets); | |||||
| if (!$packages) { | if (!$packages) { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| // Identify the packages with "Non-Owner Author" review rules and remove | // Identify the packages with "Non-Owner Author" review rules and remove | ||||
| // them if the author has authority over the package. | // them if the author has authority over the package. | ||||
| $autoreview_map = PhabricatorOwnersPackage::getAutoreviewOptionsMap(); | $autoreview_map = PhabricatorOwnersPackage::getAutoreviewOptionsMap(); | ||||
| ▲ Show 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | private function updateAffectedPathTable( | ||||
| } | } | ||||
| $changesets = $diff->getChangesets(); | $changesets = $diff->getChangesets(); | ||||
| $paths = array(); | $paths = array(); | ||||
| foreach ($changesets as $changeset) { | foreach ($changesets as $changeset) { | ||||
| $paths[] = $path_prefix.'/'.$changeset->getFilename(); | $paths[] = $path_prefix.'/'.$changeset->getFilename(); | ||||
| } | } | ||||
| // Save the affected paths; we'll use them later to query Owners. This | // If this change affected paths, save the changesets so we can apply | ||||
| // uses the un-expanded paths. | // Owners rules to them later. | ||||
| $this->affectedPaths = $paths; | if ($paths) { | ||||
| $this->ownersDiff = $diff; | |||||
| $this->ownersChangesets = $changesets; | |||||
| } | |||||
| // Mark this as also touching all parent paths, so you can see all pending | // Mark this as also touching all parent paths, so you can see all pending | ||||
| // changes to any file within a directory. | // changes to any file within a directory. | ||||
| $all_paths = array(); | $all_paths = array(); | ||||
| foreach ($paths as $local) { | foreach ($paths as $local) { | ||||
| foreach (DiffusionPathIDQuery::expandPathToRoot($local) as $path) { | foreach (DiffusionPathIDQuery::expandPathToRoot($local) as $path) { | ||||
| $all_paths[$path] = true; | $all_paths[$path] = true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 426 Lines • Show Last 20 Lines | |||||