diff --git a/src/applications/audit/query/PhabricatorCommitSearchEngine.php b/src/applications/audit/query/PhabricatorCommitSearchEngine.php --- a/src/applications/audit/query/PhabricatorCommitSearchEngine.php +++ b/src/applications/audit/query/PhabricatorCommitSearchEngine.php @@ -15,6 +15,7 @@ return id(new DiffusionCommitQuery()) ->needAuditRequests(true) ->needCommitData(true) + ->needIdentities(true) ->needDrafts(true); } diff --git a/src/applications/diffusion/DiffusionCommitAuditStatus.php b/src/applications/diffusion/DiffusionCommitAuditStatus.php --- a/src/applications/diffusion/DiffusionCommitAuditStatus.php +++ b/src/applications/diffusion/DiffusionCommitAuditStatus.php @@ -54,6 +54,10 @@ return idx($this->spec, 'color'); } + public function getAnsiColor() { + return idx($this->spec, 'color.ansi'); + } + public function getName() { return idx($this->spec, 'name', pht('Unknown ("%s")', $this->key)); } @@ -122,6 +126,7 @@ 'icon' => 'fa-check', 'color' => 'bluegrey', 'closed' => true, + 'color.ansi' => null, ), self::NEEDS_AUDIT => array( 'name' => pht('Audit Required'), @@ -129,6 +134,7 @@ 'icon' => 'fa-exclamation-circle', 'color' => 'orange', 'closed' => false, + 'color.ansi' => 'magenta', ), self::CONCERN_RAISED => array( 'name' => pht('Concern Raised'), @@ -136,6 +142,7 @@ 'icon' => 'fa-times-circle', 'color' => 'red', 'closed' => false, + 'color.ansi' => 'red', ), self::PARTIALLY_AUDITED => array( 'name' => pht('Partially Audited'), @@ -143,6 +150,7 @@ 'icon' => 'fa-check-circle-o', 'color' => 'yellow', 'closed' => false, + 'color.ansi' => 'yellow', ), self::AUDITED => array( 'name' => pht('Audited'), @@ -150,6 +158,7 @@ 'icon' => 'fa-check-circle', 'color' => 'green', 'closed' => true, + 'color.ansi' => 'green', ), self::NEEDS_VERIFICATION => array( 'name' => pht('Needs Verification'), @@ -157,6 +166,7 @@ 'icon' => 'fa-refresh', 'color' => 'indigo', 'closed' => false, + 'color.ansi' => 'magenta', ), ); } diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -851,16 +851,110 @@ ->setKey('identifier') ->setType('string') ->setDescription(pht('The commit identifier.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('repositoryPHID') + ->setType('phid') + ->setDescription(pht('The repository this commit belongs to.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('author') + ->setType('map') + ->setDescription(pht('Information about the commit author.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('committer') + ->setType('map') + ->setDescription(pht('Information about the committer.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('isImported') + ->setType('bool') + ->setDescription(pht('True if the commit is fully imported.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('isUnreachable') + ->setType('bool') + ->setDescription( + pht( + 'True if the commit is not the ancestor of any tag, branch, or '. + 'ref.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('auditStatus') + ->setType('map') + ->setDescription(pht('Information about the current audit status.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('message') + ->setType('string') + ->setDescription(pht('The commit message.')), ); } public function getFieldValuesForConduit() { + $data = $this->getCommitData(); - // NOTE: This data should be similar to the information returned about - // commmits by "differential.diff.search" with the "commits" attachment. + $author_identity = $this->getAuthorIdentity(); + if ($author_identity) { + $author_name = $author_identity->getIdentityDisplayName(); + $author_email = $author_identity->getIdentityEmailAddress(); + $author_raw = $author_identity->getIdentityName(); + $author_identity_phid = $author_identity->getPHID(); + $author_user_phid = $author_identity->getCurrentEffectiveUserPHID(); + } else { + $author_name = null; + $author_email = null; + $author_raw = null; + $author_identity_phid = null; + $author_user_phid = null; + } + + $committer_identity = $this->getCommitterIdentity(); + if ($committer_identity) { + $committer_name = $committer_identity->getIdentityDisplayName(); + $committer_email = $committer_identity->getIdentityEmailAddress(); + $committer_raw = $committer_identity->getIdentityName(); + $committer_identity_phid = $committer_identity->getPHID(); + $committer_user_phid = $committer_identity->getCurrentEffectiveUserPHID(); + } else { + $committer_name = null; + $committer_email = null; + $committer_raw = null; + $committer_identity_phid = null; + $committer_user_phid = null; + } + + $author_epoch = $data->getCommitDetail('authorEpoch'); + if ($author_epoch) { + $author_epoch = (int)$author_epoch; + } else { + $author_epoch = null; + } + + $audit_status = $this->getAuditStatusObject(); return array( 'identifier' => $this->getCommitIdentifier(), + 'repositoryPHID' => $this->getRepository()->getPHID(), + 'author' => array( + 'name' => $author_name, + 'email' => $author_email, + 'raw' => $author_raw, + 'epoch' => $author_epoch, + 'identityPHID' => $author_identity_phid, + 'userPHID' => $author_user_phid, + ), + 'committer' => array( + 'name' => $committer_name, + 'email' => $committer_email, + 'raw' => $committer_raw, + 'epoch' => (int)$this->getEpoch(), + 'identityPHID' => $committer_identity_phid, + 'userPHID' => $committer_user_phid, + ), + 'isUnreachable' => (bool)$this->isUnreachable(), + 'isImported' => (bool)$this->isImported(), + 'auditStatus' => array( + 'value' => $audit_status->getKey(), + 'name' => $audit_status->getName(), + 'closed' => (bool)$audit_status->getIsClosed(), + 'color.ansi' => $audit_status->getAnsiColor(), + ), + 'message' => $data->getCommitMessage(), ); }