@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+13 -5
+6 -2
src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php
··· 40 40 $rows = queryfx_all( 41 41 $conn_r, 42 42 'SELECT repositoryID, commitIdentifier, importStatus FROM %T 43 - WHERE repositoryID IN (%Ld) AND (importStatus & %d) != %d', 43 + WHERE repositoryID IN (%Ld) 44 + AND (importStatus & %d) != %d 45 + AND (importStatus & %d) != %d', 44 46 $table->getTableName(), 45 47 array_keys($repos), 46 48 PhabricatorRepositoryCommit::IMPORTED_ALL, 47 - PhabricatorRepositoryCommit::IMPORTED_ALL); 49 + PhabricatorRepositoryCommit::IMPORTED_ALL, 50 + PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE, 51 + PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE); 48 52 49 53 $console = PhutilConsole::getConsole(); 50 54 if ($rows) {
+7 -3
src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
··· 152 152 return; 153 153 } 154 154 155 - // Look for any commit which hasn't imported. 155 + // Look for any commit which is reachable and hasn't imported. 156 156 $unparsed_commit = queryfx_one( 157 157 $repository->establishConnection('r'), 158 - 'SELECT * FROM %T WHERE repositoryID = %d AND (importStatus & %d) != %d 158 + 'SELECT * FROM %T WHERE repositoryID = %d 159 + AND (importStatus & %d) != %d 160 + AND (importStatus & %d) != %d 159 161 LIMIT 1', 160 162 id(new PhabricatorRepositoryCommit())->getTableName(), 161 163 $repository->getID(), 162 164 PhabricatorRepositoryCommit::IMPORTED_ALL, 163 - PhabricatorRepositoryCommit::IMPORTED_ALL); 165 + PhabricatorRepositoryCommit::IMPORTED_ALL, 166 + PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE, 167 + PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE); 164 168 if ($unparsed_commit) { 165 169 // We found a commit which still needs to import, so we can't clear the 166 170 // flag.