Differential D9288 Diff 22327 src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
Show First 20 Lines • Show All 288 Lines • ▼ Show 20 Lines | abstract class PhabricatorRepositoryCommitMessageParserWorker | ||||
} | } | ||||
private function loadChangedByCommit( | private function loadChangedByCommit( | ||||
DifferentialRevision $revision, | DifferentialRevision $revision, | ||||
DifferentialDiff $diff) { | DifferentialDiff $diff) { | ||||
$repository = $this->repository; | $repository = $this->repository; | ||||
$vs_diff = id(new DifferentialDiffQuery()) | |||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | |||||
->withRevisionIDs(array($revision->getID())) | |||||
->needChangesets(true) | |||||
->setLimit(1) | |||||
->executeOne(); | |||||
if (!$vs_diff) { | |||||
return null; | |||||
} | |||||
if ($vs_diff->getCreationMethod() == 'commit') { | |||||
return null; | |||||
} | |||||
$vs_changesets = array(); | $vs_changesets = array(); | ||||
$vs_diff = id(new DifferentialDiff())->loadOneWhere( | foreach ($vs_diff->getChangesets() as $changeset) { | ||||
'revisionID = %d AND creationMethod != %s ORDER BY id DESC LIMIT 1', | |||||
$revision->getID(), | |||||
'commit'); | |||||
foreach ($vs_diff->loadChangesets() as $changeset) { | |||||
$path = $changeset->getAbsoluteRepositoryPath($repository, $vs_diff); | $path = $changeset->getAbsoluteRepositoryPath($repository, $vs_diff); | ||||
$path = ltrim($path, '/'); | $path = ltrim($path, '/'); | ||||
$vs_changesets[$path] = $changeset; | $vs_changesets[$path] = $changeset; | ||||
} | } | ||||
$changesets = array(); | $changesets = array(); | ||||
foreach ($diff->getChangesets() as $changeset) { | foreach ($diff->getChangesets() as $changeset) { | ||||
$path = $changeset->getAbsoluteRepositoryPath($repository, $diff); | $path = $changeset->getAbsoluteRepositoryPath($repository, $diff); | ||||
$path = ltrim($path, '/'); | $path = ltrim($path, '/'); | ||||
$changesets[$path] = $changeset; | $changesets[$path] = $changeset; | ||||
} | } | ||||
if (array_fill_keys(array_keys($changesets), true) != | if (array_fill_keys(array_keys($changesets), true) != | ||||
array_fill_keys(array_keys($vs_changesets), true)) { | array_fill_keys(array_keys($vs_changesets), true)) { | ||||
return $vs_diff; | return $vs_diff; | ||||
} | } | ||||
$hunks = id(new DifferentialHunk())->loadAllWhere( | |||||
'changesetID IN (%Ld)', | |||||
mpull($vs_changesets, 'getID')); | |||||
$hunks = mgroup($hunks, 'getChangesetID'); | |||||
foreach ($vs_changesets as $changeset) { | |||||
$changeset->attachHunks(idx($hunks, $changeset->getID(), array())); | |||||
} | |||||
$file_phids = array(); | $file_phids = array(); | ||||
foreach ($vs_changesets as $changeset) { | foreach ($vs_changesets as $changeset) { | ||||
$metadata = $changeset->getMetadata(); | $metadata = $changeset->getMetadata(); | ||||
$file_phid = idx($metadata, 'new:binary-phid'); | $file_phid = idx($metadata, 'new:binary-phid'); | ||||
if ($file_phid) { | if ($file_phid) { | ||||
$file_phids[$file_phid] = $file_phid; | $file_phids[$file_phid] = $file_phid; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |