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

Update PhabricatorRepositoryManagementLookupUsersWorkflow to use ConduitCall

Summary:
Ref T2783.

This updates PhabricatorRepositoryManagementLookupUsersWorkflow to use ConduitCall to retrieve information about the commit.

Test Plan:
Ran `bin/repository lookup-users rTESTe9683b64d3283f0b2d355fdbf231bc918b5ac0ab --trace` and saw the information returned (by making a request to `diffusion.querycommits` as the omnipotent user, signed with the device key).

Mucked with `cluster.addresses` and saw requests rejected.

Reviewers: hach-que, btrahan

Reviewed By: btrahan

Subscribers: Krenair, epriestley, Korvin

Maniphest Tasks: T2783

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

+39 -4
+20
src/applications/diffusion/data/DiffusionCommitRef.php
··· 9 9 private $committerEmail; 10 10 private $hashes = array(); 11 11 12 + public static function newFromConduitResult(array $result) { 13 + $ref = id(new DiffusionCommitRef()) 14 + ->setCommitterEmail(idx($result, 'committerEmail')) 15 + ->setCommitterName(idx($result, 'committerName')) 16 + ->setAuthorEmail(idx($result, 'authorEmail')) 17 + ->setAuthorName(idx($result, 'authorName')) 18 + ->setMessage(idx($result, 'message')); 19 + 20 + $hashes = array(); 21 + foreach (idx($result, 'hashes', array()) as $hash_result) { 22 + $hashes[] = id(new DiffusionCommitHash()) 23 + ->setHashType(idx($hash_result, 'type')) 24 + ->setHashValue(idx($hash_result, 'value')); 25 + } 26 + 27 + $ref->setHashes($hashes); 28 + 29 + return $ref; 30 + } 31 + 12 32 public function setHashes(array $hashes) { 13 33 $this->hashes = $hashes; 14 34 return $this;
+19 -4
src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php
··· 33 33 "%s\n", 34 34 pht('Examining commit %s...', $name)); 35 35 36 - $ref = id(new DiffusionLowLevelCommitQuery()) 37 - ->setRepository($repo) 38 - ->withIdentifier($commit->getCommitIdentifier()) 39 - ->execute(); 36 + $refs_raw = DiffusionQuery::callConduitWithDiffusionRequest( 37 + $this->getViewer(), 38 + DiffusionRequest::newFromDictionary( 39 + array( 40 + 'repository' => $repo, 41 + 'user' => $this->getViewer(), 42 + )), 43 + 'diffusion.querycommits', 44 + array( 45 + 'phids' => array($commit->getPHID()), 46 + 'bypassCache' => true, 47 + )); 48 + 49 + if (empty($refs_raw['data'])) { 50 + throw new Exception( 51 + pht('Unable to retrieve details for commit "%s"!')); 52 + } 53 + 54 + $ref = DiffusionCommitRef::newFromConduitResult(head($refs_raw['data'])); 40 55 41 56 $author = $ref->getAuthor(); 42 57 $console->writeOut(