Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / repository / management / PhabricatorRepositoryManagementDiscoverWorkflow.php
blobeb9437dbf9668af578945b0f5a356aea399499f2
1 <?php
3 final class PhabricatorRepositoryManagementDiscoverWorkflow
4 extends PhabricatorRepositoryManagementWorkflow {
6 protected function didConstruct() {
7 $this
8 ->setName('discover')
9 ->setExamples('**discover** [__options__] __repository__ ...')
10 ->setSynopsis(pht('Discover commits in __repository__.'))
11 ->setArguments(
12 array(
13 array(
14 'name' => 'verbose',
15 'help' => pht('Show additional debugging information.'),
17 array(
18 'name' => 'repair',
19 'help' => pht(
20 'Discover all commits, even if they are ancestors of known '.
21 'commits. This can repair gaps in repository history.'),
23 array(
24 'name' => 'repos',
25 'wildcard' => true,
27 ));
30 public function execute(PhutilArgumentParser $args) {
31 $repos = $this->loadLocalRepositories($args, 'repos');
33 if (!$repos) {
34 throw new PhutilArgumentUsageException(
35 pht('Specify one or more repositories to discover.'));
38 $console = PhutilConsole::getConsole();
39 foreach ($repos as $repo) {
40 $console->writeOut(
41 "%s\n",
42 pht(
43 'Discovering "%s"...',
44 $repo->getDisplayName()));
46 id(new PhabricatorRepositoryDiscoveryEngine())
47 ->setRepository($repo)
48 ->setVerbose($args->getArg('verbose'))
49 ->setRepairMode($args->getArg('repair'))
50 ->discoverCommits();
53 $console->writeOut("%s\n", pht('Done.'));
55 return 0;