Page MenuHomePhabricator
Paste P1100

repo_phid.php
ActivePublic

Authored by epriestley on Mar 24 2014, 11:42 PM.
Tags
None
Referenced Files
F134385: repo_phid.php
Mar 24 2014, 11:42 PM
Subscribers
None
<?php
require_once 'scripts/__init_script__.php';
$conn_w = id(new DifferentialRevision())->establishConnection('w');
foreach (new LiskMigrationIterator(new DifferentialRevision()) as $rev) {
$id = $rev->getID();
echo "Checking D{$id}...\n";
if ($rev->getRepositoryPHID()) {
// Already has a repository PHID, skip it.
continue;
}
$diff = $rev->loadActiveDiff();
if (!$diff) {
// Oldschool broken no-diff rev, skip it.
continue;
}
if (!$diff->getRepositoryPHID()) {
// Diff doesn't have a repository PHID either, skip it.
continue;
}
echo "Updating D{$id}...\n";
queryfx(
$conn_w,
'UPDATE %T SET repositoryPHID = %s WHERE id = %d',
id(new DifferentialRevision())->getTableName(),
$diff->getRepositoryPHID(),
$id);
}
echo "Done.\n";

Event Timeline

epriestley changed the title of this paste from untitled to repo_phid.php.
epriestley updated the paste's language from autodetect to autodetect.