Differential D21460 Diff 51088 src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
Show First 20 Lines • Show All 547 Lines • ▼ Show 20 Lines | foreach (PhabricatorLiskDAO::chunkSQL($identifier_tokens) as $chunk) { | ||||
$repository->getID(), | $repository->getID(), | ||||
$chunk); | $chunk); | ||||
foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
$all_commits[] = $row; | $all_commits[] = $row; | ||||
} | } | ||||
} | } | ||||
$closeable_flag = PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE; | $closeable_flag = PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE; | ||||
$published_flag = PhabricatorRepositoryCommit::IMPORTED_PUBLISH; | |||||
$all_commits = ipull($all_commits, null, 'commitIdentifier'); | $all_commits = ipull($all_commits, null, 'commitIdentifier'); | ||||
foreach ($identifiers as $identifier) { | foreach ($identifiers as $identifier) { | ||||
$row = idx($all_commits, $identifier); | $row = idx($all_commits, $identifier); | ||||
if (!$row) { | if (!$row) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Commit "%s" has not been discovered yet! Run discovery before '. | 'Commit "%s" has not been discovered yet! Run discovery before '. | ||||
'updating refs.', | 'updating refs.', | ||||
$identifier)); | $identifier)); | ||||
} | } | ||||
if (!($row['importStatus'] & $closeable_flag)) { | $import_status = $row['importStatus']; | ||||
if (!($import_status & $closeable_flag)) { | |||||
// Set the "closeable" flag. | |||||
$import_status = ($import_status | $closeable_flag); | |||||
// See T13580. Clear the "published" flag, so publishing executes | |||||
// again. We may have previously performed a no-op "publish" on the | |||||
// commit to make sure it has all bits in the "IMPORTED_ALL" bitmask. | |||||
$import_status = ($import_status & ~$published_flag); | |||||
queryfx( | queryfx( | ||||
$conn, | $conn, | ||||
'UPDATE %T SET importStatus = (importStatus | %d) WHERE id = %d', | 'UPDATE %T SET importStatus = %d WHERE id = %d', | ||||
$commit_table->getTableName(), | $commit_table->getTableName(), | ||||
$closeable_flag, | $import_status, | ||||
$row['id']); | $row['id']); | ||||
$data = array( | $data = array( | ||||
'commitID' => $row['id'], | 'commitID' => $row['id'], | ||||
); | ); | ||||
PhabricatorWorker::scheduleTask( | PhabricatorWorker::scheduleTask( | ||||
$class, | $class, | ||||
▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines |