diff --git a/src/applications/differential/controller/DifferentialController.php b/src/applications/differential/controller/DifferentialController.php --- a/src/applications/differential/controller/DifferentialController.php +++ b/src/applications/differential/controller/DifferentialController.php @@ -80,12 +80,10 @@ ->setCoverageID($coverage_id); if ($have_owners) { - $package = $control_query->getControllingPackageForPath( + $packages = $control_query->getControllingPackagesForPath( $repository_phid, $changeset->getFilename()); - if ($package) { - $item->setPackage($package); - } + $item->setPackages($packages); } $toc_view->addItem($item); diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -1123,12 +1123,10 @@ )); if ($have_owners) { - $package = $control_query->getControllingPackageForPath( + $packages = $control_query->getControllingPackagesForPath( $repository_phid, $changeset->getFilename()); - if ($package) { - $item->setPackage($package); - } + $item->setPackages($packages); } $toc_view->addItem($item); diff --git a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php --- a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php +++ b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php @@ -343,27 +343,13 @@ /** - * Get the package which controls a path, if one exists. - * - * @return PhabricatorOwnersPackage|null Package, if one exists. - */ - public function getControllingPackageForPath($repository_phid, $path) { - $packages = $this->getControllingPackagesForPath($repository_phid, $path); - - if (!$packages) { - return null; - } - - return head($packages); - } - - - /** * Get a list of all packages which control a path or its parent directories, * ordered from weakest to strongest. * * The first package has the most specific claim on the path; the last - * package has the most general claim. + * package has the most general claim. Multiple packages may have claims of + * equal strength, so this ordering is primarily one of usability and + * convenience. * * @return list List of controlling packages. */ diff --git a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php --- a/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php +++ b/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php @@ -8,7 +8,7 @@ private $coverage; private $coverageID; private $context; - private $package; + private $packages; public function setChangeset(DifferentialChangeset $changeset) { $this->changeset = $changeset; @@ -64,13 +64,14 @@ return $this->context; } - public function setPackage(PhabricatorOwnersPackage $package) { - $this->package = $package; + public function setPackages(array $packages) { + assert_instances_of($packages, 'PhabricatorOwnersPackage'); + $this->packages = mpull($packages, null, 'getPHID'); return $this; } - public function getPackage() { - return $this->package; + public function getPackages() { + return $this->packages; } public function render() { @@ -97,7 +98,7 @@ $cells[] = $this->renderCoverage(); $cells[] = $this->renderModifiedCoverage(); - $cells[] = $this->renderPackage(); + $cells[] = $this->renderPackages(); return $cells; } @@ -284,14 +285,16 @@ $meta); } - private function renderPackage() { - $package = $this->getPackage(); - - if (!$package) { + private function renderPackages() { + $packages = $this->getPackages(); + if (!$packages) { return null; } - return $this->getUser()->renderHandle($package->getPHID()); + $viewer = $this->getUser(); + $package_phids = mpull($packages, 'getPHID'); + + return $viewer->renderHandleList($package_phids); } private function renderRename($self, $other, $arrow) { diff --git a/src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php b/src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php --- a/src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php +++ b/src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php @@ -43,9 +43,9 @@ $have_authority = false; - $package = $item->getPackage(); - if ($package) { - if (isset($authority[$package->getPHID()])) { + $packages = $item->getPackages(); + if ($packages) { + if (array_intersect_key($packages, $authority)) { $have_authority = true; } } @@ -61,7 +61,7 @@ // just hide them. $any_coverage = false; $any_context = false; - $any_package = false; + $any_packages = false; foreach ($items as $item) { if ($item->getContext() !== null) { $any_context = true; @@ -71,8 +71,8 @@ $any_coverage = true; } - if ($item->getPackage() !== null) { - $any_package = true; + if ($item->getPackages() !== null) { + $any_packages = true; } } @@ -103,7 +103,7 @@ pht('Path'), pht('Coverage (All)'), pht('Coverage (Touched)'), - pht('Package'), + pht('Packages'), )) ->setColumnClasses( array( @@ -125,7 +125,7 @@ true, $any_coverage, $any_coverage, - $any_package, + $any_packages, )) ->setDeviceVisibility( array(