mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
Ignore unreachable commits when testing if a repository has imported
Summary: Fixes T11309. When checking if a repository was fully imported, we incorrectly allow unreachable, un-imported commits to prevent the repository from moving to "Imported". This can happen if you delete branches from a repository while it is importing. Instead, ignore unreachable commits when checking for remaining imports, and when reporting status via `bin/repository importing`. Test Plan: - Stopped daemons. - Created a new repository and activated it. - Ran `bin/repository update Rxx`. - Deleted a branch in the repository. - Ran `bin/repository update Rxx`. - Ran daemons to flush queue. Now: - Ran `bin/repository importing`. Old behavior: showed unreachable commits as importing. New behavior: does not show unreachable commits. - Ran `bin/repository update`. Old behavior: failed to move repository to "imported" status. New behavior: correctly moves repository to "imported" status. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11309 Differential Revision: https://secure.phabricator.com/D16269
This commit is contained in:
parent
4068ee2a75
commit
553c335fbd
2 changed files with 13 additions and 5 deletions
|
@ -40,11 +40,15 @@ final class PhabricatorRepositoryManagementImportingWorkflow
|
|||
$rows = queryfx_all(
|
||||
$conn_r,
|
||||
'SELECT repositoryID, commitIdentifier, importStatus FROM %T
|
||||
WHERE repositoryID IN (%Ld) AND (importStatus & %d) != %d',
|
||||
WHERE repositoryID IN (%Ld)
|
||||
AND (importStatus & %d) != %d
|
||||
AND (importStatus & %d) != %d',
|
||||
$table->getTableName(),
|
||||
array_keys($repos),
|
||||
PhabricatorRepositoryCommit::IMPORTED_ALL,
|
||||
PhabricatorRepositoryCommit::IMPORTED_ALL);
|
||||
PhabricatorRepositoryCommit::IMPORTED_ALL,
|
||||
PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE,
|
||||
PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE);
|
||||
|
||||
$console = PhutilConsole::getConsole();
|
||||
if ($rows) {
|
||||
|
|
|
@ -152,15 +152,19 @@ final class PhabricatorRepositoryManagementUpdateWorkflow
|
|||
return;
|
||||
}
|
||||
|
||||
// Look for any commit which hasn't imported.
|
||||
// Look for any commit which is reachable and hasn't imported.
|
||||
$unparsed_commit = queryfx_one(
|
||||
$repository->establishConnection('r'),
|
||||
'SELECT * FROM %T WHERE repositoryID = %d AND (importStatus & %d) != %d
|
||||
'SELECT * FROM %T WHERE repositoryID = %d
|
||||
AND (importStatus & %d) != %d
|
||||
AND (importStatus & %d) != %d
|
||||
LIMIT 1',
|
||||
id(new PhabricatorRepositoryCommit())->getTableName(),
|
||||
$repository->getID(),
|
||||
PhabricatorRepositoryCommit::IMPORTED_ALL,
|
||||
PhabricatorRepositoryCommit::IMPORTED_ALL);
|
||||
PhabricatorRepositoryCommit::IMPORTED_ALL,
|
||||
PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE,
|
||||
PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE);
|
||||
if ($unparsed_commit) {
|
||||
// We found a commit which still needs to import, so we can't clear the
|
||||
// flag.
|
||||
|
|
Loading…
Reference in a new issue