mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-01 06:59:15 +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:
parent
3f0ffaa9eb
commit
e1d2523efe
1 changed files with 19 additions and 18 deletions
|
@ -65,9 +65,27 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
|
||||||
reset($field_values['reviewedByPHIDs']));
|
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(
|
$data->setCommitDetail(
|
||||||
'differential.revisionID',
|
'differential.revisionID',
|
||||||
idx($field_values, 'revisionID'));
|
$revision_id);
|
||||||
|
|
||||||
$committer_phid = $this->lookupUser(
|
$committer_phid = $this->lookupUser(
|
||||||
$commit,
|
$commit,
|
||||||
|
@ -94,23 +112,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
|
||||||
|
|
||||||
$revision = null;
|
$revision = null;
|
||||||
$should_autoclose = $repository->shouldAutocloseCommit($commit, $data);
|
$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) {
|
if ($revision_id) {
|
||||||
$lock = PhabricatorGlobalLock::newLock(get_class($this).':'.$revision_id);
|
$lock = PhabricatorGlobalLock::newLock(get_class($this).':'.$revision_id);
|
||||||
|
|
Loading…
Add table
Reference in a new issue