Differential D14924 Diff 36062 src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php
<?php | <?php | ||||
final class PhabricatorRepositoryManagementImportingWorkflow | final class PhabricatorRepositoryManagementImportingWorkflow | ||||
extends PhabricatorRepositoryManagementWorkflow { | extends PhabricatorRepositoryManagementWorkflow { | ||||
protected function didConstruct() { | protected function didConstruct() { | ||||
$this | $this | ||||
->setName('importing') | ->setName('importing') | ||||
->setExamples('**importing** __repository__ ...') | ->setExamples('**importing** __repository__ ...') | ||||
->setSynopsis( | ->setSynopsis( | ||||
pht( | pht( | ||||
'Show commits in __repository__, named by callsign, which are '. | 'Show commits in __repository__ which are still importing.')) | ||||
'still importing.')) | |||||
->setArguments( | ->setArguments( | ||||
array( | array( | ||||
array( | array( | ||||
'name' => 'simple', | 'name' => 'simple', | ||||
'help' => pht('Show simpler output.'), | 'help' => pht('Show simpler output.'), | ||||
), | ), | ||||
array( | array( | ||||
'name' => 'repos', | 'name' => 'repos', | ||||
'wildcard' => true, | 'wildcard' => true, | ||||
), | ), | ||||
)); | )); | ||||
} | } | ||||
public function execute(PhutilArgumentParser $args) { | public function execute(PhutilArgumentParser $args) { | ||||
$repos = $this->loadRepositories($args, 'repos'); | $repos = $this->loadRepositories($args, 'repos'); | ||||
if (!$repos) { | if (!$repos) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht( | pht( | ||||
'Specify one or more repositories to find importing commits for, '. | 'Specify one or more repositories to find importing commits for.')); | ||||
'by callsign.')); | |||||
} | } | ||||
$repos = mpull($repos, null, 'getID'); | $repos = mpull($repos, null, 'getID'); | ||||
$table = new PhabricatorRepositoryCommit(); | $table = new PhabricatorRepositoryCommit(); | ||||
$conn_r = $table->establishConnection('r'); | $conn_r = $table->establishConnection('r'); | ||||
$rows = queryfx_all( | $rows = queryfx_all( | ||||
$conn_r, | $conn_r, | ||||
'SELECT repositoryID, commitIdentifier, importStatus FROM %T | 'SELECT repositoryID, commitIdentifier, importStatus FROM %T | ||||
WHERE repositoryID IN (%Ld) AND (importStatus & %d) != %d', | WHERE repositoryID IN (%Ld) AND (importStatus & %d) != %d', | ||||
$table->getTableName(), | $table->getTableName(), | ||||
array_keys($repos), | array_keys($repos), | ||||
PhabricatorRepositoryCommit::IMPORTED_ALL, | PhabricatorRepositoryCommit::IMPORTED_ALL, | ||||
PhabricatorRepositoryCommit::IMPORTED_ALL); | PhabricatorRepositoryCommit::IMPORTED_ALL); | ||||
$console = PhutilConsole::getConsole(); | $console = PhutilConsole::getConsole(); | ||||
if ($rows) { | if ($rows) { | ||||
foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
$repo = $repos[$row['repositoryID']]; | $repo = $repos[$row['repositoryID']]; | ||||
$identifier = $row['commitIdentifier']; | $identifier = $row['commitIdentifier']; | ||||
$console->writeOut('%s', 'r'.$repo->getCallsign().$identifier); | $console->writeOut('%s', $repo->formatCommitName($identifier)); | ||||
if (!$args->getArg('simple')) { | if (!$args->getArg('simple')) { | ||||
$status = $row['importStatus']; | $status = $row['importStatus']; | ||||
$need = array(); | $need = array(); | ||||
if (!($status & PhabricatorRepositoryCommit::IMPORTED_MESSAGE)) { | if (!($status & PhabricatorRepositoryCommit::IMPORTED_MESSAGE)) { | ||||
$need[] = pht('Message'); | $need[] = pht('Message'); | ||||
} | } | ||||
if (!($status & PhabricatorRepositoryCommit::IMPORTED_CHANGE)) { | if (!($status & PhabricatorRepositoryCommit::IMPORTED_CHANGE)) { | ||||
Show All 24 Lines |