Skip to content

Commit e1d2523

Browse files
committed
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
1 parent 3f0ffaa commit e1d2523

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,27 @@ final protected function updateCommitData($author, $message,
6565
reset($field_values['reviewedByPHIDs']));
6666
}
6767

68+
$revision_id = idx($field_values, 'revisionID');
69+
if (!$revision_id) {
70+
$hashes = $this->getCommitHashes(
71+
$repository,
72+
$commit);
73+
if ($hashes) {
74+
$revisions = id(new DifferentialRevisionQuery())
75+
->setViewer(PhabricatorUser::getOmnipotentUser())
76+
->withCommitHashes($hashes)
77+
->execute();
78+
79+
if (!empty($revisions)) {
80+
$revision = $this->identifyBestRevision($revisions);
81+
$revision_id = $revision->getID();
82+
}
83+
}
84+
}
85+
6886
$data->setCommitDetail(
6987
'differential.revisionID',
70-
idx($field_values, 'revisionID'));
88+
$revision_id);
7189

7290
$committer_phid = $this->lookupUser(
7391
$commit,
@@ -94,23 +112,6 @@ final protected function updateCommitData($author, $message,
94112

95113
$revision = null;
96114
$should_autoclose = $repository->shouldAutocloseCommit($commit, $data);
97-
$revision_id = $data->getCommitDetail('differential.revisionID');
98-
if (!$revision_id) {
99-
$hashes = $this->getCommitHashes(
100-
$this->repository,
101-
$this->commit);
102-
if ($hashes) {
103-
$revisions = id(new DifferentialRevisionQuery())
104-
->setViewer(PhabricatorUser::getOmnipotentUser())
105-
->withCommitHashes($hashes)
106-
->execute();
107-
108-
if (!empty($revisions)) {
109-
$revision = $this->identifyBestRevision($revisions);
110-
$revision_id = $revision->getID();
111-
}
112-
}
113-
}
114115

115116
if ($revision_id) {
116117
$lock = PhabricatorGlobalLock::newLock(get_class($this).':'.$revision_id);

0 commit comments

Comments
 (0)