1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 14:30:56 +01:00

Diffusion - fix another commit importing case.

Summary: Fixes T6395. Ref T6350. I guess I missed this code spot in prior testing / I definitely didn't run an empty commit through it. Works now though.

Test Plan: made an empty commit and observed stuck importing status and errors in phd log. applied patch and commit successfully imported with no errors. made another empty commit and it imported as well

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6350, T6395

Differential Revision: https://secure.phabricator.com/D10746
This commit is contained in:
Bob Trahan 2014-10-27 12:19:07 -07:00
parent a4b281aa29
commit 0dcc4132be
2 changed files with 17 additions and 1 deletions

View file

@ -23,4 +23,15 @@ final class DiffusionCommitHash extends Phobject {
return $this->hashType; return $this->hashType;
} }
public static function convertArrayToObjects(array $hashes) {
$hash_objects = array();
foreach ($hashes as $hash) {
$type = $hash[0];
$hash = $hash[1];
$hash_objects[] = id(new DiffusionCommitHash())
->setHashType($type)
->setHashValue($hash);
}
return $hash_objects;
}
} }

View file

@ -71,6 +71,8 @@ final class DiffusionLowLevelCommitFieldsQuery
$revision = $this->pickBestRevision($revisions); $revision = $this->pickBestRevision($revisions);
$fields['revisionID'] = $revision->getID(); $fields['revisionID'] = $revision->getID();
$revision_hashes = $revision->getHashes(); $revision_hashes = $revision->getHashes();
$revision_hashes = DiffusionCommitHash::convertArrayToObjects(
$revision_hashes);
$revision_hashes = mpull($revision_hashes, 'getHashType'); $revision_hashes = mpull($revision_hashes, 'getHashType');
// sort the hashes in the order the mighty // sort the hashes in the order the mighty
// @{class:ArcanstDifferentialRevisionHash} does; probably unnecessary // @{class:ArcanstDifferentialRevisionHash} does; probably unnecessary
@ -79,7 +81,10 @@ final class DiffusionLowLevelCommitFieldsQuery
$revision_hashes, $revision_hashes,
ArcanistDifferentialRevisionHash::getTypes()); ArcanistDifferentialRevisionHash::getTypes());
foreach ($hashes as $hash) { foreach ($hashes as $hash) {
$revision_hash = $revision_hashes[$hash->getHashType()]; $revision_hash = idx($revision_hashes, $hash->getHashType());
if (!$revision_hash) {
continue;
}
if ($revision_hash->getHashValue() == $hash->getHashValue()) { if ($revision_hash->getHashValue() == $hash->getHashValue()) {
$this->setRevisionMatchData( $this->setRevisionMatchData(
'matchHashType', 'matchHashType',