Audit - add ability to query by repositories
Summary: Fixes T5862. The Diffusion table uses `id` but all the other infrastructure uses `phid` so just do a quick load of the repositories to get the ids. Long term, we should re-key the table by phid I think. Test Plan: made a query with a repository and got a proper result set Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5862 Differential Revision: https://secure.phabricator.com/D10245
This commit is contained in:
@@ -59,6 +59,25 @@ final class DiffusionCommitQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up commits in a specific repository. Prefer
|
||||
* @{method:withRepositoryIDs}; the underyling table is keyed by ID such
|
||||
* that this method requires a separate initial query to map PHID to ID.
|
||||
* Furthermore, this method requires calling @{method:setViewer} in
|
||||
* advance due to the separate query.
|
||||
*/
|
||||
public function withRepositoryPHIDs(array $phids) {
|
||||
$repositories = id (new PhabricatorRepositoryQuery())
|
||||
->setViewer($this->getViewer())
|
||||
->withPHIDs($phids)
|
||||
->execute();
|
||||
|
||||
if (!$repositories) {
|
||||
throw new PhabricatorEmptyQueryException();
|
||||
}
|
||||
$this->withRepositoryIDs(mpull($repositories, 'getID'));
|
||||
}
|
||||
|
||||
/**
|
||||
* If a default repository is provided, ambiguous commit identifiers will
|
||||
* be assumed to belong to the default repository.
|
||||
|
||||
Reference in New Issue
Block a user