Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / audit / query / DiffusionInternalCommitSearchEngine.php
blob45780140fbc89b38193b81a559a17628f3892ec3
1 <?php
3 final class DiffusionInternalCommitSearchEngine
4 extends PhabricatorApplicationSearchEngine {
6 public function getResultTypeDescription() {
7 return pht('Diffusion Raw Commits');
10 public function getApplicationClassName() {
11 return 'PhabricatorDiffusionApplication';
14 public function newQuery() {
15 return new DiffusionCommitQuery();
18 protected function buildQueryFromParameters(array $map) {
19 $query = $this->newQuery();
21 if ($map['repositoryPHIDs']) {
22 $query->withRepositoryPHIDs($map['repositoryPHIDs']);
25 return $query;
28 protected function buildCustomSearchFields() {
29 return array(
30 id(new PhabricatorSearchDatasourceField())
31 ->setLabel(pht('Repositories'))
32 ->setKey('repositoryPHIDs')
33 ->setDatasource(new DiffusionRepositoryFunctionDatasource())
34 ->setDescription(pht('Find commits in particular repositories.')),
38 protected function getURI($path) {
39 return null;
42 protected function renderResultList(
43 array $commits,
44 PhabricatorSavedQuery $query,
45 array $handles) {
46 return null;
49 protected function getObjectWireFieldsForConduit(
50 $object,
51 array $field_extensions,
52 array $extension_data) {
54 $commit = $object;
55 $viewer = $this->requireViewer();
57 $repository = $commit->getRepository();
58 $identifier = $commit->getCommitIdentifier();
60 id(new DiffusionRepositoryClusterEngine())
61 ->setViewer($viewer)
62 ->setRepository($repository)
63 ->synchronizeWorkingCopyBeforeRead();
65 $ref = id(new DiffusionLowLevelCommitQuery())
66 ->setRepository($repository)
67 ->withIdentifier($identifier)
68 ->execute();
70 return array(
71 'ref' => $ref->newDictionary(),