Page MenuHomePhabricator

D9361.id22289.diff
No OneTemporary

D9361.id22289.diff

diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementParentsWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementParentsWorkflow.php
--- a/src/applications/repository/management/PhabricatorRepositoryManagementParentsWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementParentsWorkflow.php
@@ -100,6 +100,9 @@
$bar = id(new PhutilConsoleProgressBar())
->setTotal(count($graph));
+ $insert_sql = array();
+ $delete_sql = array();
+
foreach ($graph as $child => $parents) {
$names = $parents;
$names[] = $child;
@@ -119,16 +122,15 @@
}
}
- $sql = array();
if (!$parents) {
// Write an explicit 0 to indicate "no parents" instead of "no data".
- $sql[] = qsprintf(
+ $insert_sql[] = qsprintf(
$conn_w,
'(%d, 0)',
$map[$child]);
} else {
foreach ($parents as $parent) {
- $sql[] = qsprintf(
+ $insert_sql[] = qsprintf(
$conn_w,
'(%d, %d)',
$map[$child],
@@ -136,25 +138,27 @@
}
}
- $commit_table->openTransaction();
- queryfx(
- $conn_w,
- 'DELETE FROM %T WHERE childCommitID = %d',
- PhabricatorRepository::TABLE_PARENTS,
- $map[$child]);
-
- if ($sql) {
- queryfx(
- $conn_w,
- 'INSERT INTO %T (childCommitID, parentCommitID) VALUES %Q',
- PhabricatorRepository::TABLE_PARENTS,
- implode(', ', $sql));
- }
- $commit_table->saveTransaction();
+ $delete_sql[] = $map[$child];
$bar->update(1);
}
+ $commit_table->openTransaction();
+ queryfx(
+ $conn_w,
+ 'DELETE FROM %T WHERE childCommitID IN (%Q)',
+ PhabricatorRepository::TABLE_PARENTS,
+ implode(', ', $delete_sql));
+
+ if ($insert_sql) {
+ queryfx(
+ $conn_w,
+ 'INSERT INTO %T (childCommitID, parentCommitID) VALUES %Q',
+ PhabricatorRepository::TABLE_PARENTS,
+ implode(', ', $insert_sql));
+ }
+ $commit_table->saveTransaction();
+
$bar->done();
}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 3:46 PM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7713393
Default Alt Text
D9361.id22289.diff (2 KB)

Event Timeline