1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

make commit message worker savvier around revision ids

Summary: Fixes T2836

Test Plan: make a diff, get it approved, arc land, verify things okay. ask users on T2836 to try.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Maniphest Tasks: T2836

Differential Revision: https://secure.phabricator.com/D6770
This commit is contained in:
Bob Trahan 2013-08-19 12:39:20 -07:00
parent 3f0ffaa9eb
commit e1d2523efe

View file

@ -65,9 +65,27 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
reset($field_values['reviewedByPHIDs']));
}
$revision_id = idx($field_values, 'revisionID');
if (!$revision_id) {
$hashes = $this->getCommitHashes(
$repository,
$commit);
if ($hashes) {
$revisions = id(new DifferentialRevisionQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withCommitHashes($hashes)
->execute();
if (!empty($revisions)) {
$revision = $this->identifyBestRevision($revisions);
$revision_id = $revision->getID();
}
}
}
$data->setCommitDetail(
'differential.revisionID',
idx($field_values, 'revisionID'));
$revision_id);
$committer_phid = $this->lookupUser(
$commit,
@ -94,23 +112,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
$revision = null;
$should_autoclose = $repository->shouldAutocloseCommit($commit, $data);
$revision_id = $data->getCommitDetail('differential.revisionID');
if (!$revision_id) {
$hashes = $this->getCommitHashes(
$this->repository,
$this->commit);
if ($hashes) {
$revisions = id(new DifferentialRevisionQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withCommitHashes($hashes)
->execute();
if (!empty($revisions)) {
$revision = $this->identifyBestRevision($revisions);
$revision_id = $revision->getID();
}
}
}
if ($revision_id) {
$lock = PhabricatorGlobalLock::newLock(get_class($this).':'.$revision_id);