Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13995575
D13362.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D13362.diff
View Options
diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php
--- a/src/applications/diffusion/query/DiffusionCommitQuery.php
+++ b/src/applications/diffusion/query/DiffusionCommitQuery.php
@@ -17,6 +17,9 @@
private $auditorPHIDs;
private $auditAwaitingUser;
private $auditStatus;
+ private $epochMin;
+ private $epochMax;
+ private $importing;
const AUDIT_STATUS_ANY = 'audit-status-any';
const AUDIT_STATUS_OPEN = 'audit-status-open';
@@ -141,6 +144,17 @@
return $this;
}
+ public function withEpochRange($min, $max) {
+ $this->epochMin = $min;
+ $this->epochMax = $max;
+ return $this;
+ }
+
+ public function withImporting($importing) {
+ $this->importing = $importing;
+ return $this;
+ }
+
public function getIdentifierMap() {
if ($this->identifierMap === null) {
throw new Exception(
@@ -329,6 +343,36 @@
$this->authorPHIDs);
}
+ if ($this->epochMin !== null) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'commit.epoch >= %d',
+ $this->epochMin);
+ }
+
+ if ($this->epochMax !== null) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'commit.epoch <= %d',
+ $this->epochMax);
+ }
+
+ if ($this->importing !== null) {
+ if ($this->importing) {
+ $where[] = qsprintf(
+ $conn_r,
+ '(commit.importStatus & %d) != %d',
+ PhabricatorRepositoryCommit::IMPORTED_ALL,
+ PhabricatorRepositoryCommit::IMPORTED_ALL);
+ } else {
+ $where[] = qsprintf(
+ $conn_r,
+ '(commit.importStatus & %d) = %d',
+ PhabricatorRepositoryCommit::IMPORTED_ALL,
+ PhabricatorRepositoryCommit::IMPORTED_ALL);
+ }
+ }
+
if ($this->identifiers !== null) {
$min_unqualified = PhabricatorRepository::MINIMUM_UNQUALIFIED_HASH;
$min_qualified = PhabricatorRepository::MINIMUM_QUALIFIED_HASH;
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php
--- a/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php
@@ -84,11 +84,16 @@
'--all'),
),
array(
+ 'name' => 'importing',
+ 'help' => pht(
+ 'Reparse all steps which have not yet completed.'),
+ ),
+ array(
'name' => 'force-autoclose',
'help' => pht(
- 'Only used with __%s, use this to make sure any '.
+ 'Only used with __%s__, use this to make sure any '.
'pertinent diffs are closed regardless of configuration.',
- '--message__'),
+ '--message'),
),
));
@@ -106,6 +111,7 @@
$force = $args->getArg('force');
$force_local = $args->getArg('force-local');
$min_date = $args->getArg('min-date');
+ $importing = $args->getArg('importing');
if (!$all_from_repo && !$reparse_what) {
throw new PhutilArgumentUsageException(
@@ -123,16 +129,31 @@
$commits));
}
- if (!$reparse_message && !$reparse_change && !$reparse_herald &&
- !$reparse_owners) {
+ $any_step = ($reparse_message ||
+ $reparse_change ||
+ $reparse_herald ||
+ $reparse_owners);
+
+ if ($any_step && $importing) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify what information to reparse with %s, %s, %s, and/or %s.',
+ 'Choosing steps with %s conflicts with flags which select '.
+ 'specific steps.',
+ '--importing'));
+ } else if ($any_step) {
+ // OK.
+ } else if ($importing) {
+ // OK.
+ } else if (!$any_step && !$importing) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'Specify which steps to reparse with %s, or %s, %s, %s, or %s.',
+ '--importing',
'--message',
'--change',
'--herald',
'--owners'));
- }
+ }
$min_timestamp = false;
if ($min_date) {
@@ -179,27 +200,28 @@
throw new PhutilArgumentUsageException(
pht('Unknown repository %s!', $all_from_repo));
}
- $constraint = '';
+
+
+ $query = id(new DiffusionCommitQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->withRepository($repository);
+
if ($min_timestamp) {
- $console->writeOut("%s\n", pht(
- 'Excluding entries before UNIX timestamp: %s',
- $min_timestamp));
- $table = new PhabricatorRepositoryCommit();
- $conn_r = $table->establishConnection('r');
- $constraint = qsprintf(
- $conn_r,
- 'AND epoch >= %d',
- $min_timestamp);
+ $query->withEpochRange($min_timestamp, null);
}
- $commits = id(new PhabricatorRepositoryCommit())->loadAllWhere(
- 'repositoryID = %d %Q',
- $repository->getID(),
- $constraint);
+
+ if ($importing) {
+ $query->withImporting(true);
+ }
+
+ $commits = $query->execute();
+
$callsign = $repository->getCallsign();
if (!$commits) {
- throw new PhutilArgumentUsageException(pht(
- "No commits have been discovered in %s repository!\n",
- $callsign));
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'No commits have been discovered in %s repository!',
+ $callsign));
}
} else {
$commits = array();
@@ -250,6 +272,26 @@
$tasks = array();
foreach ($commits as $commit) {
+ if ($importing) {
+ $status = $commit->getImportStatus();
+ // Find the first missing import step and queue that up.
+ $reparse_message = false;
+ $reparse_change = false;
+ $reparse_owners = false;
+ $reparse_herald = false;
+ if (!($status & PhabricatorRepositoryCommit::IMPORTED_MESSAGE)) {
+ $reparse_message = true;
+ } else if (!($status & PhabricatorRepositoryCommit::IMPORTED_CHANGE)) {
+ $reparse_change = true;
+ } else if (!($status & PhabricatorRepositoryCommit::IMPORTED_OWNERS)) {
+ $reparse_owners = true;
+ } else if (!($status & PhabricatorRepositoryCommit::IMPORTED_HERALD)) {
+ $reparse_herald = true;
+ } else {
+ continue;
+ }
+ }
+
$classes = array();
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
@@ -287,9 +329,13 @@
$classes[] = 'PhabricatorRepositoryCommitOwnersWorker';
}
+ // NOTE: With "--importing", we queue the first unparsed step and let
+ // it queue the other ones normally. Without "--importing", we queue
+ // all the requested steps explicitly.
+
$spec = array(
'commitID' => $commit->getID(),
- 'only' => true,
+ 'only' => !$importing,
'forceAutoclose' => $args->getArg('force-autoclose'),
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 24, 2:00 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6715455
Default Alt Text
D13362.diff (7 KB)
Attached To
Mode
D13362: Add an "--importing" flag to bin/repository reparse
Attached
Detach File
Event Timeline
Log In to Comment