in src/shipit/phase/ShipItDeleteCorruptedRepoPhase.php [109:144]
private async function genIsCorruptedHGRepo(
string $local_path,
): Awaitable<bool> {
// Given ShipItRepoHG's lock usage, there should never be a transaction in
// progress if we have the lock.
if (PHP\file_exists($local_path.'/.hg/store/journal')) {
return true;
}
$result = await (
new ShipItShellCommand(
$local_path,
'hg',
'log',
'-r',
'tip',
'--template',
"{node}\n",
)
)
->setNoExceptions()
->setEnvironmentVariables(dict['HGPLAIN' => '1'])
->genRun();
if ($result->getExitCode() !== 0) {
return true;
}
$revision = Str\trim($result->getStdOut());
if (Regex\matches($revision, re'/^0+$/')) {
// 000000...0 is not a valid revision ID, but it's what we get
// for an empty repository
return true;
}
return false;
}