From e1d2523efeb4ed2c6f295602401f9b02cbda3216 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 19 Aug 2013 12:39:20 -0700 Subject: [PATCH] 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 --- ...torRepositoryCommitMessageParserWorker.php | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index c77d724cbf..6758f4413c 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -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);