Changeset View
Changeset View
Standalone View
Standalone View
src/applications/owners/query/PhabricatorOwnersPackageQuery.php
Show First 20 Lines • Show All 352 Lines • ▼ Show 20 Lines | public function getControllingPackagesForPath($repository_phid, $path) { | ||||
$packages = $this->controlResults; | $packages = $this->controlResults; | ||||
$weak_dominion = PhabricatorOwnersPackage::DOMINION_WEAK; | $weak_dominion = PhabricatorOwnersPackage::DOMINION_WEAK; | ||||
$matches = array(); | $matches = array(); | ||||
foreach ($packages as $package_id => $package) { | foreach ($packages as $package_id => $package) { | ||||
$best_match = null; | $best_match = null; | ||||
$include = false; | $include = false; | ||||
// If this package is archived, it's no longer a controlling package | |||||
// for the given path. In particular, it can not force active packages | |||||
// with weak dominion to give up control. | |||||
if ($package->isArchived()) { | |||||
continue; | |||||
} | |||||
epriestley: This isn't technically necessary because callers already specify active-packages-only. I think… | |||||
foreach ($package->getPaths() as $package_path) { | foreach ($package->getPaths() as $package_path) { | ||||
if ($package_path->getRepositoryPHID() != $repository_phid) { | if ($package_path->getRepositoryPHID() != $repository_phid) { | ||||
// If this path is for some other repository, skip it. | // If this path is for some other repository, skip it. | ||||
continue; | continue; | ||||
} | } | ||||
$strength = $package_path->getPathMatchStrength($path); | $strength = $package_path->getPathMatchStrength($path); | ||||
if ($strength > $best_match) { | if ($strength > $best_match) { | ||||
Show All 33 Lines |
This isn't technically necessary because callers already specify active-packages-only. I think it's reasonable to bake the rule "archived packages can never control paths" into this API, but it's something that might eventually merit adjustment, particularly if we're eventually able to get all of the code running through this logic.