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

[releeph] Conduit failure with bad IDs

Summary:
Instead of returning a blank result it throws exceptions. Fix this up a
little so we get some consistency with differential

Test Plan:
Loaded a bad phid for releeph, returns empty list.
Try a good phid and get 2 releeph merges.

Reviewers: epriestley, elenaperezrioja, dschleimer, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

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

+39 -17
+3
src/applications/releeph/conduit/ConduitAPI_releeph_queryrequests_Method.php
··· 46 46 47 47 foreach ($releephRequests as $releephRequest) { 48 48 $branch = $releephRequest->loadReleephBranch(); 49 + if (!$branch) { 50 + continue; 51 + } 49 52 $request_commit_phid = $releephRequest->getRequestCommitPHID(); 50 53 $revisionPHID = 51 54 $query->getRevisionPHID($request_commit_phid);
+28 -16
src/applications/releeph/query/ReleephRequestQuery.php
··· 10 10 private $severities; 11 11 private $requestorPHIDs; 12 12 private $branchIDs; 13 + private $revisionPHIDs; 13 14 14 15 const STATUS_ALL = 'status-all'; 15 16 const STATUS_OPEN = 'status-open'; ··· 67 68 } 68 69 69 70 public function withRevisionPHIDs(array $revision_phids) { 70 - $type = PhabricatorEdgeConfig::TYPE_DREV_HAS_COMMIT; 71 - 72 - $edges = id(new PhabricatorEdgeQuery()) 73 - ->withSourcePHIDs($revision_phids) 74 - ->withEdgeTypes(array($type)) 75 - ->execute(); 76 - 77 - $this->commitToRevMap = array(); 78 - 79 - foreach ($edges as $revision_phid => $edge) { 80 - foreach ($edge[$type] as $commitPHID => $item) { 81 - $this->commitToRevMap[$commitPHID] = $revision_phid; 82 - } 83 - } 84 - 85 - $this->requestedCommitPHIDs = array_keys($this->commitToRevMap); 71 + $this->revisionPHIDs = $revision_phids; 72 + return $this; 86 73 } 87 74 88 75 public function loadPage() { ··· 170 157 $conn_r, 171 158 'requestUserPHID IN (%Ls)', 172 159 $this->requestorPHIDs); 160 + } 161 + 162 + if ($this->revisionPHIDs) { 163 + $type = PhabricatorEdgeConfig::TYPE_DREV_HAS_COMMIT; 164 + 165 + $edges = id(new PhabricatorEdgeQuery()) 166 + ->withSourcePHIDs($this->revisionPHIDs) 167 + ->withEdgeTypes(array($type)) 168 + ->execute(); 169 + 170 + $this->commitToRevMap = array(); 171 + foreach ($edges as $revision_phid => $edge) { 172 + foreach ($edge[$type] as $commitPHID => $item) { 173 + $this->commitToRevMap[$commitPHID] = $revision_phid; 174 + } 175 + } 176 + 177 + if (!$this->commitToRevMap) { 178 + throw new PhabricatorEmptyQueryException("Malformed Revision Phids"); 179 + } 180 + 181 + $where[] = qsprintf( 182 + $conn_r, 183 + 'requestCommitPHID IN (%Ls)', 184 + array_keys($this->commitToRevMap)); 173 185 } 174 186 175 187 $where[] = $this->buildPagingClause($conn_r);
+8 -1
src/applications/releeph/storage/ReleephRequest.php
··· 55 55 */ 56 56 public function getPusherIntent() { 57 57 $project = $this->loadReleephProject(); 58 + if (!$project) { 59 + return null; 60 + } 61 + 58 62 if (!$project->getPushers()) { 59 63 return self::INTENT_WANT; 60 64 } ··· 228 232 } 229 233 230 234 public function loadReleephProject() { 231 - return $this->loadReleephBranch()->loadReleephProject(); 235 + $branch = $this->loadReleephBranch(); 236 + if ($branch) { 237 + return $branch->loadReleephProject(); 238 + } 232 239 } 233 240 234 241 public function loadPhabricatorRepositoryCommit() {