@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 calls to getCallsign() from repository daemons

Summary: Ref T4245. These are all descriptive or UI-facing.

Test Plan:
- Ran `bin/repository pull ...` with various identifiers.
- Ran `bin/repository mirror ...` with various identifiers.
- Ran `bin/repository discover ...` with various identifiers.
- Ran `bin/phd debug pull X Y --not Z` with various identifiers.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4245

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

+44 -30
+27 -14
src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
··· 6 6 * 7 7 * By default, the daemon pulls **every** repository. If you want it to be 8 8 * responsible for only some repositories, you can launch it with a list of 9 - * PHIDs or callsigns: 9 + * repositories: 10 10 * 11 11 * ./phd launch repositorypulllocal -- X Q Z 12 12 * ··· 228 228 $flags[] = '--no-discovery'; 229 229 } 230 230 231 - $callsign = $repository->getCallsign(); 232 - 233 - $future = new ExecFuture('%s update %Ls -- %s', $bin, $flags, $callsign); 231 + $monogram = $repository->getMonogram(); 232 + $future = new ExecFuture('%s update %Ls -- %s', $bin, $flags, $monogram); 234 233 235 234 // Sometimes, the underlying VCS commands will hang indefinitely. We've 236 235 // observed this occasionally with GitHub, and other users have observed ··· 303 302 ->setViewer($this->getViewer()); 304 303 305 304 if ($include) { 306 - $query->withCallsigns($include); 305 + $query->withIdentifiers($include); 307 306 } 308 307 309 308 $repositories = $query->execute(); 309 + $repositories = mpull($repositories, null, 'getPHID'); 310 310 311 311 if ($include) { 312 - $by_callsign = mpull($repositories, null, 'getCallsign'); 313 - foreach ($include as $name) { 314 - if (empty($by_callsign[$name])) { 312 + $map = $query->getIdentifierMap(); 313 + foreach ($include as $identifier) { 314 + if (empty($map[$identifier])) { 315 315 throw new Exception( 316 316 pht( 317 - "No repository exists with callsign '%s'!", 318 - $name)); 317 + 'No repository "%s" exists!', 318 + $identifier)); 319 319 } 320 320 } 321 321 } 322 322 323 323 if ($exclude) { 324 - $exclude = array_fuse($exclude); 325 - foreach ($repositories as $key => $repository) { 326 - if (isset($exclude[$repository->getCallsign()])) { 327 - unset($repositories[$key]); 324 + $xquery = id(new PhabricatorRepositoryQuery()) 325 + ->setViewer($this->getViewer()) 326 + ->withIdentifiers($exclude); 327 + 328 + $excluded_repos = $xquery->execute(); 329 + $xmap = $xquery->getIdentifierMap(); 330 + 331 + foreach ($exclude as $identifier) { 332 + if (empty($xmap[$identifier])) { 333 + throw new Exception( 334 + pht( 335 + 'No repository "%s" exists!', 336 + $identifier)); 328 337 } 338 + } 339 + 340 + foreach ($excluded_repos as $excluded_repo) { 341 + unset($repositories[$excluded_repo->getPHID()]); 329 342 } 330 343 } 331 344
+3 -3
src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
··· 100 100 101 101 $this->log( 102 102 pht( 103 - 'Discovering commits in repository %s.', 104 - $repository->getCallsign())); 103 + 'Discovering commits in repository "%s".', 104 + $repository->getDisplayName())); 105 105 106 106 $this->fillCommitCache(array_values($branches)); 107 107 ··· 244 244 'configured URI is "%s". To resolve this error, set the remote URI '. 245 245 'to point at the repository root. If you want to import only part '. 246 246 'of a Subversion repository, use the "Import Only" option.', 247 - $repository->getCallsign(), 247 + $repository->getDisplayName(), 248 248 $remote_root, 249 249 $expect_root)); 250 250 }
+1 -1
src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php
··· 37 37 throw new PhutilAggregateException( 38 38 pht( 39 39 'Exceptions occurred while mirroring the "%s" repository.', 40 - $repository->getCallsign()), 40 + $repository->getDisplayName()), 41 41 $exceptions); 42 42 } 43 43 }
+13 -12
src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
··· 29 29 $is_svn = false; 30 30 31 31 $vcs = $repository->getVersionControlSystem(); 32 - $callsign = $repository->getCallsign(); 33 32 34 33 switch ($vcs) { 35 34 case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: ··· 37 36 if (!$repository->isHosted()) { 38 37 $this->skipPull( 39 38 pht( 40 - "Repository '%s' is a non-hosted Subversion repository, which ". 41 - "does not require a local working copy to be pulled.", 42 - $callsign)); 39 + 'Repository "%s" is a non-hosted Subversion repository, which '. 40 + 'does not require a local working copy to be pulled.', 41 + $repository->getDisplayName())); 43 42 return; 44 43 } 45 44 $is_svn = true; ··· 55 54 break; 56 55 } 57 56 58 - $callsign = $repository->getCallsign(); 59 57 $local_path = $repository->getLocalPath(); 60 58 if ($local_path === null) { 61 59 $this->abortPull( 62 60 pht( 63 - "No local path is configured for repository '%s'.", 64 - $callsign)); 61 + 'No local path is configured for repository "%s".', 62 + $repository->getDisplayName())); 65 63 } 66 64 67 65 try { ··· 73 71 if (!Filesystem::pathExists($local_path)) { 74 72 $this->logPull( 75 73 pht( 76 - "Creating a new working copy for repository '%s'.", 77 - $callsign)); 74 + 'Creating a new working copy for repository "%s".', 75 + $repository->getDisplayName())); 78 76 if ($is_git) { 79 77 $this->executeGitCreate(); 80 78 } else if ($is_hg) { ··· 86 84 if (!$repository->isHosted()) { 87 85 $this->logPull( 88 86 pht( 89 - "Updating the working copy for repository '%s'.", 90 - $callsign)); 87 + 'Updating the working copy for repository "%s".', 88 + $repository->getDisplayName())); 91 89 if ($is_git) { 92 90 $this->verifyGitOrigin($repository); 93 91 $this->executeGitUpdate(); ··· 113 111 114 112 } catch (Exception $ex) { 115 113 $this->abortPull( 116 - pht('Pull of "%s" failed: %s', $callsign, $ex->getMessage()), 114 + pht( 115 + "Pull of '%s' failed: %s", 116 + $repository->getDisplayName(), 117 + $ex->getMessage()), 117 118 $ex); 118 119 } 119 120