Page MenuHomePhabricator

D7515.diff

diff --git a/scripts/repository/manage_repositories.php b/scripts/repository/manage_repositories.php
--- a/scripts/repository/manage_repositories.php
+++ b/scripts/repository/manage_repositories.php
@@ -21,6 +21,7 @@
new PhabricatorRepositoryManagementListWorkflow(),
new PhabricatorRepositoryManagementDeleteWorkflow(),
new PhabricatorRepositoryManagementMarkImportedWorkflow(),
+ new PhabricatorRepositoryManagementImportingWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1660,6 +1660,7 @@
'PhabricatorRepositoryListController' => 'applications/repository/controller/PhabricatorRepositoryListController.php',
'PhabricatorRepositoryManagementDeleteWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementDeleteWorkflow.php',
'PhabricatorRepositoryManagementDiscoverWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php',
+ 'PhabricatorRepositoryManagementImportingWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php',
'PhabricatorRepositoryManagementListWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementListWorkflow.php',
'PhabricatorRepositoryManagementMarkImportedWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementMarkImportedWorkflow.php',
'PhabricatorRepositoryManagementPullWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php',
@@ -4013,6 +4014,7 @@
'PhabricatorRepositoryListController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryManagementDeleteWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
'PhabricatorRepositoryManagementDiscoverWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
+ 'PhabricatorRepositoryManagementImportingWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
'PhabricatorRepositoryManagementListWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
'PhabricatorRepositoryManagementMarkImportedWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
'PhabricatorRepositoryManagementPullWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php
new file mode 100644
--- /dev/null
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php
@@ -0,0 +1,86 @@
+<?php
+
+final class PhabricatorRepositoryManagementImportingWorkflow
+ extends PhabricatorRepositoryManagementWorkflow {
+
+ public function didConstruct() {
+ $this
+ ->setName('importing')
+ ->setExamples('**importing** __repository__ ...')
+ ->setSynopsis(
+ 'Show commits in __repository__, named by callsign, which are still '.
+ 'importing.')
+ ->setArguments(
+ array(
+ array(
+ 'name' => 'simple',
+ 'help' => 'Show simpler output.',
+ ),
+ array(
+ 'name' => 'repos',
+ 'wildcard' => true,
+ ),
+ ));
+ }
+
+ public function execute(PhutilArgumentParser $args) {
+ $repos = $this->loadRepositories($args, 'repos');
+
+ if (!$repos) {
+ throw new PhutilArgumentUsageException(
+ "Specify one or more repositories to find importing commits for, ".
+ "by callsign.");
+ }
+
+ $repos = mpull($repos, null, 'getID');
+
+ $table = new PhabricatorRepositoryCommit();
+ $conn_r = $table->establishConnection('r');
+
+ $rows = queryfx_all(
+ $conn_r,
+ 'SELECT repositoryID, commitIdentifier, importStatus FROM %T
+ WHERE repositoryID IN (%Ld) AND importStatus != %d',
+ $table->getTableName(),
+ array_keys($repos),
+ PhabricatorRepositoryCommit::IMPORTED_ALL);
+
+ $console = PhutilConsole::getConsole();
+ if ($rows) {
+ foreach ($rows as $row) {
+ $repo = $repos[$row['repositoryID']];
+ $identifier = $row['commitIdentifier'];
+
+ $console->writeOut("%s", 'r'.$repo->getCallsign().$identifier);
+
+ if (!$args->getArg('simple')) {
+ $status = $row['importStatus'];
+ $need = array();
+ if (!($status & PhabricatorRepositoryCommit::IMPORTED_MESSAGE)) {
+ $need[] = 'Message';
+ }
+ if (!($status & PhabricatorRepositoryCommit::IMPORTED_CHANGE)) {
+ $need[] = 'Change';
+ }
+ if (!($status & PhabricatorRepositoryCommit::IMPORTED_OWNERS)) {
+ $need[] = 'Owners';
+ }
+ if (!($status & PhabricatorRepositoryCommit::IMPORTED_HERALD)) {
+ $need[] = 'Herald';
+ }
+
+ $console->writeOut(" %s", implode(', ', $need));
+ }
+
+ $console->writeOut("\n");
+ }
+ } else {
+ $console->writeErr(
+ "%s\n",
+ pht('No importing commits found.'));
+ }
+
+ return 0;
+ }
+
+}

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/sb/mw/tcrhhhw7piwfry4c
Default Alt Text
D7515.diff (5 KB)

Event Timeline