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

Remove "bin/repository lookup-users" workflow

Summary:
Ref T13552. This is one of two callsites to "diffusion.querycommits". It's an old debugging workflow which I haven't used in years and which is likely obsoleted by identities and other changes.

I believe the root problem here was also ultimately user error (a user has misconfigured their local Git author email as another user).

Test Plan: Grepped for "lookup-users", got no hits.

Maniphest Tasks: T13552

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

-117
-2
src/__phutil_library_map__.php
··· 4588 4588 'PhabricatorRepositoryManagementImportingWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php', 4589 4589 'PhabricatorRepositoryManagementListPathsWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementListPathsWorkflow.php', 4590 4590 'PhabricatorRepositoryManagementListWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementListWorkflow.php', 4591 - 'PhabricatorRepositoryManagementLookupUsersWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php', 4592 4591 'PhabricatorRepositoryManagementMaintenanceWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php', 4593 4592 'PhabricatorRepositoryManagementMarkImportedWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementMarkImportedWorkflow.php', 4594 4593 'PhabricatorRepositoryManagementMarkReachableWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementMarkReachableWorkflow.php', ··· 11326 11325 'PhabricatorRepositoryManagementImportingWorkflow' => 'PhabricatorRepositoryManagementWorkflow', 11327 11326 'PhabricatorRepositoryManagementListPathsWorkflow' => 'PhabricatorRepositoryManagementWorkflow', 11328 11327 'PhabricatorRepositoryManagementListWorkflow' => 'PhabricatorRepositoryManagementWorkflow', 11329 - 'PhabricatorRepositoryManagementLookupUsersWorkflow' => 'PhabricatorRepositoryManagementWorkflow', 11330 11328 'PhabricatorRepositoryManagementMaintenanceWorkflow' => 'PhabricatorRepositoryManagementWorkflow', 11331 11329 'PhabricatorRepositoryManagementMarkImportedWorkflow' => 'PhabricatorRepositoryManagementWorkflow', 11332 11330 'PhabricatorRepositoryManagementMarkReachableWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
-115
src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php
··· 1 - <?php 2 - 3 - final class PhabricatorRepositoryManagementLookupUsersWorkflow 4 - extends PhabricatorRepositoryManagementWorkflow { 5 - 6 - protected function didConstruct() { 7 - $this 8 - ->setName('lookup-users') 9 - ->setExamples('**lookup-users** __commit__ ...') 10 - ->setSynopsis( 11 - pht('Resolve user accounts for users attached to __commit__.')) 12 - ->setArguments( 13 - array( 14 - array( 15 - 'name' => 'commits', 16 - 'wildcard' => true, 17 - ), 18 - )); 19 - } 20 - 21 - public function execute(PhutilArgumentParser $args) { 22 - $commits = $this->loadCommits($args, 'commits'); 23 - if (!$commits) { 24 - throw new PhutilArgumentUsageException( 25 - pht('Specify one or more commits to resolve users for.')); 26 - } 27 - 28 - $console = PhutilConsole::getConsole(); 29 - foreach ($commits as $commit) { 30 - $repo = $commit->getRepository(); 31 - $name = $repo->formatCommitName($commit->getCommitIdentifier()); 32 - 33 - $console->writeOut( 34 - "%s\n", 35 - pht('Examining commit %s...', $name)); 36 - 37 - $refs_raw = DiffusionQuery::callConduitWithDiffusionRequest( 38 - $this->getViewer(), 39 - DiffusionRequest::newFromDictionary( 40 - array( 41 - 'repository' => $repo, 42 - 'user' => $this->getViewer(), 43 - )), 44 - 'diffusion.querycommits', 45 - array( 46 - 'repositoryPHID' => $repo->getPHID(), 47 - 'phids' => array($commit->getPHID()), 48 - 'bypassCache' => true, 49 - )); 50 - 51 - if (empty($refs_raw['data'])) { 52 - throw new Exception( 53 - pht( 54 - 'Unable to retrieve details for commit "%s"!', 55 - $commit->getPHID())); 56 - } 57 - 58 - $ref = DiffusionCommitRef::newFromConduitResult(head($refs_raw['data'])); 59 - 60 - $author = $ref->getAuthor(); 61 - $console->writeOut( 62 - "%s\n", 63 - pht('Raw author string: %s', coalesce($author, 'null'))); 64 - 65 - if ($author !== null) { 66 - $handle = $this->resolveUser($commit, $author); 67 - if ($handle) { 68 - $console->writeOut( 69 - "%s\n", 70 - pht('Phabricator user: %s', $handle->getFullName())); 71 - } else { 72 - $console->writeOut( 73 - "%s\n", 74 - pht('Unable to resolve a corresponding Phabricator user.')); 75 - } 76 - } 77 - 78 - $committer = $ref->getCommitter(); 79 - $console->writeOut( 80 - "%s\n", 81 - pht('Raw committer string: %s', coalesce($committer, 'null'))); 82 - 83 - if ($committer !== null) { 84 - $handle = $this->resolveUser($commit, $committer); 85 - if ($handle) { 86 - $console->writeOut( 87 - "%s\n", 88 - pht('Phabricator user: %s', $handle->getFullName())); 89 - } else { 90 - $console->writeOut( 91 - "%s\n", 92 - pht('Unable to resolve a corresponding Phabricator user.')); 93 - } 94 - } 95 - } 96 - 97 - return 0; 98 - } 99 - 100 - private function resolveUser(PhabricatorRepositoryCommit $commit, $name) { 101 - $phid = id(new DiffusionResolveUserQuery()) 102 - ->withName($name) 103 - ->execute(); 104 - 105 - if (!$phid) { 106 - return null; 107 - } 108 - 109 - return id(new PhabricatorHandleQuery()) 110 - ->setViewer($this->getViewer()) 111 - ->withPHIDs(array($phid)) 112 - ->executeOne(); 113 - } 114 - 115 - }