@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.

[conduit: query owners packages by repository]

Summary:
There wasn't an easy way to see all the packages that cover a particular
directory. This adds the option

This is useful to see what's covered within a repo.

Test Plan:
* Queried with a valid repository and path - got the results
as before.
* Queried with a repository and no path - got an error as before.
* Queried with a repository and an asterix as the path - got all the
packages within the repository.

Revert Plan: sure

Other Notes:

Reviewers: epriestley, edward

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3016

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

+20 -4
+7 -4
src/applications/owners/conduit/ConduitAPI_owners_query_Method.php
··· 74 74 ->setErrorDescription( 75 75 'Repository callsign '.$repo_callsign.' not recognized'); 76 76 } 77 - 78 - return PhabricatorOwnersPackage::loadOwningPackages( 79 - $repository, $path); 77 + if ($path == null) { 78 + return PhabricatorOwnersPackage::loadPackagesForRepository($repository); 79 + } else { 80 + return PhabricatorOwnersPackage::loadOwningPackages( 81 + $repository, $path); 82 + } 80 83 } 81 84 82 85 public static function buildPackageInformationDictionaries($packages) { ··· 116 119 117 120 $repo = $request->getValue('repositoryCallsign'); 118 121 $path = $request->getValue('path'); 119 - $is_path_query = ($repo && $path) ? 1 : 0; 122 + $is_path_query = $repo ? 1 : 0; 120 123 121 124 if ($is_owner_query + $is_path_query + $is_affiliated_query === 0) { 122 125 // if no search terms are provided, return everything
+13
src/applications/owners/storage/PhabricatorOwnersPackage.php
··· 182 182 return $packages; 183 183 } 184 184 185 + public static function loadPackagesForRepository($repository) { 186 + $package = new PhabricatorOwnersPackage(); 187 + $ids = ipull( 188 + queryfx_all( 189 + $package->establishConnection('r'), 190 + 'SELECT DISTINCT packageID FROM %T WHERE repositoryPHID = %s', 191 + id(new PhabricatorOwnersPath())->getTableName(), 192 + $repository->getPHID()), 193 + 'packageID'); 194 + 195 + return $package->loadAllWhere('id in (%Ld)', $ids); 196 + } 197 + 185 198 public static function findLongestPathsPerPackage(array $rows, array $paths) { 186 199 $ids = array(); 187 200