@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Show all packages with a claim on a file in the table of contents view

Summary:
Ref T9218. See discussion there for rationale; I think this is the right behavior to pursue.

The screenshot below is pretty ugly. I think it's a lot worse than most real-world cases will be, since you have to sort of opt-in to having crazy levels of overlapping packages, and it's perfectly normal/reasonable for files owned by one package. Owners is powerful enough to let you specify sub-packages with exclusive ownership.

That said, this may be more typical than I hope. I don't think we can reduce the complexity here much for free, but it would might be reasonable to add some view options (e.g.: group by package?, show only packages I own?, show packages as icons with a tooltip?) if it's an issue.

Test Plan: {F734956}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9218

Differential Revision: https://secure.phabricator.com/D13940

+29 -44
+2 -4
src/applications/differential/controller/DifferentialController.php
··· 80 80 ->setCoverageID($coverage_id); 81 81 82 82 if ($have_owners) { 83 - $package = $control_query->getControllingPackageForPath( 83 + $packages = $control_query->getControllingPackagesForPath( 84 84 $repository_phid, 85 85 $changeset->getFilename()); 86 - if ($package) { 87 - $item->setPackage($package); 88 - } 86 + $item->setPackages($packages); 89 87 } 90 88 91 89 $toc_view->addItem($item);
+2 -4
src/applications/diffusion/controller/DiffusionCommitController.php
··· 1123 1123 )); 1124 1124 1125 1125 if ($have_owners) { 1126 - $package = $control_query->getControllingPackageForPath( 1126 + $packages = $control_query->getControllingPackagesForPath( 1127 1127 $repository_phid, 1128 1128 $changeset->getFilename()); 1129 - if ($package) { 1130 - $item->setPackage($package); 1131 - } 1129 + $item->setPackages($packages); 1132 1130 } 1133 1131 1134 1132 $toc_view->addItem($item);
+3 -17
src/applications/owners/query/PhabricatorOwnersPackageQuery.php
··· 343 343 344 344 345 345 /** 346 - * Get the package which controls a path, if one exists. 347 - * 348 - * @return PhabricatorOwnersPackage|null Package, if one exists. 349 - */ 350 - public function getControllingPackageForPath($repository_phid, $path) { 351 - $packages = $this->getControllingPackagesForPath($repository_phid, $path); 352 - 353 - if (!$packages) { 354 - return null; 355 - } 356 - 357 - return head($packages); 358 - } 359 - 360 - 361 - /** 362 346 * Get a list of all packages which control a path or its parent directories, 363 347 * ordered from weakest to strongest. 364 348 * 365 349 * The first package has the most specific claim on the path; the last 366 - * package has the most general claim. 350 + * package has the most general claim. Multiple packages may have claims of 351 + * equal strength, so this ordering is primarily one of usability and 352 + * convenience. 367 353 * 368 354 * @return list<PhabricatorOwnersPackage> List of controlling packages. 369 355 */
+14 -11
src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php
··· 8 8 private $coverage; 9 9 private $coverageID; 10 10 private $context; 11 - private $package; 11 + private $packages; 12 12 13 13 public function setChangeset(DifferentialChangeset $changeset) { 14 14 $this->changeset = $changeset; ··· 64 64 return $this->context; 65 65 } 66 66 67 - public function setPackage(PhabricatorOwnersPackage $package) { 68 - $this->package = $package; 67 + public function setPackages(array $packages) { 68 + assert_instances_of($packages, 'PhabricatorOwnersPackage'); 69 + $this->packages = mpull($packages, null, 'getPHID'); 69 70 return $this; 70 71 } 71 72 72 - public function getPackage() { 73 - return $this->package; 73 + public function getPackages() { 74 + return $this->packages; 74 75 } 75 76 76 77 public function render() { ··· 97 98 $cells[] = $this->renderCoverage(); 98 99 $cells[] = $this->renderModifiedCoverage(); 99 100 100 - $cells[] = $this->renderPackage(); 101 + $cells[] = $this->renderPackages(); 101 102 102 103 return $cells; 103 104 } ··· 284 285 $meta); 285 286 } 286 287 287 - private function renderPackage() { 288 - $package = $this->getPackage(); 289 - 290 - if (!$package) { 288 + private function renderPackages() { 289 + $packages = $this->getPackages(); 290 + if (!$packages) { 291 291 return null; 292 292 } 293 293 294 - return $this->getUser()->renderHandle($package->getPHID()); 294 + $viewer = $this->getUser(); 295 + $package_phids = mpull($packages, 'getPHID'); 296 + 297 + return $viewer->renderHandleList($package_phids); 295 298 } 296 299 297 300 private function renderRename($self, $other, $arrow) {
+8 -8
src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php
··· 43 43 44 44 $have_authority = false; 45 45 46 - $package = $item->getPackage(); 47 - if ($package) { 48 - if (isset($authority[$package->getPHID()])) { 46 + $packages = $item->getPackages(); 47 + if ($packages) { 48 + if (array_intersect_key($packages, $authority)) { 49 49 $have_authority = true; 50 50 } 51 51 } ··· 61 61 // just hide them. 62 62 $any_coverage = false; 63 63 $any_context = false; 64 - $any_package = false; 64 + $any_packages = false; 65 65 foreach ($items as $item) { 66 66 if ($item->getContext() !== null) { 67 67 $any_context = true; ··· 71 71 $any_coverage = true; 72 72 } 73 73 74 - if ($item->getPackage() !== null) { 75 - $any_package = true; 74 + if ($item->getPackages() !== null) { 75 + $any_packages = true; 76 76 } 77 77 } 78 78 ··· 103 103 pht('Path'), 104 104 pht('Coverage (All)'), 105 105 pht('Coverage (Touched)'), 106 - pht('Package'), 106 + pht('Packages'), 107 107 )) 108 108 ->setColumnClasses( 109 109 array( ··· 125 125 true, 126 126 $any_coverage, 127 127 $any_coverage, 128 - $any_package, 128 + $any_packages, 129 129 )) 130 130 ->setDeviceVisibility( 131 131 array(