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

Enrich "diffusion.commit.search" with identity, status, and message information

Summary:
Depends on D19657. Ref T13197. See PHI841.

This enriches the results from `diffusion.commit.search` with information similar to the information returned by the "commits" attachment from `differential.diff.search`.

Also include unreachable, imported, message, audit status, and repository PHID.

Test Plan: Called `diffusion.commit.search` and reviewed the results, which looked sensible.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13197

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

+107 -2
+1
src/applications/audit/query/PhabricatorCommitSearchEngine.php
··· 15 15 return id(new DiffusionCommitQuery()) 16 16 ->needAuditRequests(true) 17 17 ->needCommitData(true) 18 + ->needIdentities(true) 18 19 ->needDrafts(true); 19 20 } 20 21
+10
src/applications/diffusion/DiffusionCommitAuditStatus.php
··· 54 54 return idx($this->spec, 'color'); 55 55 } 56 56 57 + public function getAnsiColor() { 58 + return idx($this->spec, 'color.ansi'); 59 + } 60 + 57 61 public function getName() { 58 62 return idx($this->spec, 'name', pht('Unknown ("%s")', $this->key)); 59 63 } ··· 122 126 'icon' => 'fa-check', 123 127 'color' => 'bluegrey', 124 128 'closed' => true, 129 + 'color.ansi' => null, 125 130 ), 126 131 self::NEEDS_AUDIT => array( 127 132 'name' => pht('Audit Required'), ··· 129 134 'icon' => 'fa-exclamation-circle', 130 135 'color' => 'orange', 131 136 'closed' => false, 137 + 'color.ansi' => 'magenta', 132 138 ), 133 139 self::CONCERN_RAISED => array( 134 140 'name' => pht('Concern Raised'), ··· 136 142 'icon' => 'fa-times-circle', 137 143 'color' => 'red', 138 144 'closed' => false, 145 + 'color.ansi' => 'red', 139 146 ), 140 147 self::PARTIALLY_AUDITED => array( 141 148 'name' => pht('Partially Audited'), ··· 143 150 'icon' => 'fa-check-circle-o', 144 151 'color' => 'yellow', 145 152 'closed' => false, 153 + 'color.ansi' => 'yellow', 146 154 ), 147 155 self::AUDITED => array( 148 156 'name' => pht('Audited'), ··· 150 158 'icon' => 'fa-check-circle', 151 159 'color' => 'green', 152 160 'closed' => true, 161 + 'color.ansi' => 'green', 153 162 ), 154 163 self::NEEDS_VERIFICATION => array( 155 164 'name' => pht('Needs Verification'), ··· 157 166 'icon' => 'fa-refresh', 158 167 'color' => 'indigo', 159 168 'closed' => false, 169 + 'color.ansi' => 'magenta', 160 170 ), 161 171 ); 162 172 }
+96 -2
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 851 851 ->setKey('identifier') 852 852 ->setType('string') 853 853 ->setDescription(pht('The commit identifier.')), 854 + id(new PhabricatorConduitSearchFieldSpecification()) 855 + ->setKey('repositoryPHID') 856 + ->setType('phid') 857 + ->setDescription(pht('The repository this commit belongs to.')), 858 + id(new PhabricatorConduitSearchFieldSpecification()) 859 + ->setKey('author') 860 + ->setType('map<string, wild>') 861 + ->setDescription(pht('Information about the commit author.')), 862 + id(new PhabricatorConduitSearchFieldSpecification()) 863 + ->setKey('committer') 864 + ->setType('map<string, wild>') 865 + ->setDescription(pht('Information about the committer.')), 866 + id(new PhabricatorConduitSearchFieldSpecification()) 867 + ->setKey('isImported') 868 + ->setType('bool') 869 + ->setDescription(pht('True if the commit is fully imported.')), 870 + id(new PhabricatorConduitSearchFieldSpecification()) 871 + ->setKey('isUnreachable') 872 + ->setType('bool') 873 + ->setDescription( 874 + pht( 875 + 'True if the commit is not the ancestor of any tag, branch, or '. 876 + 'ref.')), 877 + id(new PhabricatorConduitSearchFieldSpecification()) 878 + ->setKey('auditStatus') 879 + ->setType('map<string, wild>') 880 + ->setDescription(pht('Information about the current audit status.')), 881 + id(new PhabricatorConduitSearchFieldSpecification()) 882 + ->setKey('message') 883 + ->setType('string') 884 + ->setDescription(pht('The commit message.')), 854 885 ); 855 886 } 856 887 857 888 public function getFieldValuesForConduit() { 889 + $data = $this->getCommitData(); 858 890 859 - // NOTE: This data should be similar to the information returned about 860 - // commmits by "differential.diff.search" with the "commits" attachment. 891 + $author_identity = $this->getAuthorIdentity(); 892 + if ($author_identity) { 893 + $author_name = $author_identity->getIdentityDisplayName(); 894 + $author_email = $author_identity->getIdentityEmailAddress(); 895 + $author_raw = $author_identity->getIdentityName(); 896 + $author_identity_phid = $author_identity->getPHID(); 897 + $author_user_phid = $author_identity->getCurrentEffectiveUserPHID(); 898 + } else { 899 + $author_name = null; 900 + $author_email = null; 901 + $author_raw = null; 902 + $author_identity_phid = null; 903 + $author_user_phid = null; 904 + } 905 + 906 + $committer_identity = $this->getCommitterIdentity(); 907 + if ($committer_identity) { 908 + $committer_name = $committer_identity->getIdentityDisplayName(); 909 + $committer_email = $committer_identity->getIdentityEmailAddress(); 910 + $committer_raw = $committer_identity->getIdentityName(); 911 + $committer_identity_phid = $committer_identity->getPHID(); 912 + $committer_user_phid = $committer_identity->getCurrentEffectiveUserPHID(); 913 + } else { 914 + $committer_name = null; 915 + $committer_email = null; 916 + $committer_raw = null; 917 + $committer_identity_phid = null; 918 + $committer_user_phid = null; 919 + } 920 + 921 + $author_epoch = $data->getCommitDetail('authorEpoch'); 922 + if ($author_epoch) { 923 + $author_epoch = (int)$author_epoch; 924 + } else { 925 + $author_epoch = null; 926 + } 927 + 928 + $audit_status = $this->getAuditStatusObject(); 861 929 862 930 return array( 863 931 'identifier' => $this->getCommitIdentifier(), 932 + 'repositoryPHID' => $this->getRepository()->getPHID(), 933 + 'author' => array( 934 + 'name' => $author_name, 935 + 'email' => $author_email, 936 + 'raw' => $author_raw, 937 + 'epoch' => $author_epoch, 938 + 'identityPHID' => $author_identity_phid, 939 + 'userPHID' => $author_user_phid, 940 + ), 941 + 'committer' => array( 942 + 'name' => $committer_name, 943 + 'email' => $committer_email, 944 + 'raw' => $committer_raw, 945 + 'epoch' => (int)$this->getEpoch(), 946 + 'identityPHID' => $committer_identity_phid, 947 + 'userPHID' => $committer_user_phid, 948 + ), 949 + 'isUnreachable' => (bool)$this->isUnreachable(), 950 + 'isImported' => (bool)$this->isImported(), 951 + 'auditStatus' => array( 952 + 'value' => $audit_status->getKey(), 953 + 'name' => $audit_status->getName(), 954 + 'closed' => (bool)$audit_status->getIsClosed(), 955 + 'color.ansi' => $audit_status->getAnsiColor(), 956 + ), 957 + 'message' => $data->getCommitMessage(), 864 958 ); 865 959 } 866 960