1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-31 08:58:20 +01:00

Added commit information to 'getrevision' conduit call.

Summary:
differential.getrevision now returns commits for a given revision.
URI is also return in differential.getrevision.

Test Plan:
Tested from Conduit Console UI that the calls were working
correctly.

Reviewed By: jungejason
Reviewers: jungejason
CC: epriestley, simpkins, dpepper, jungejason
Differential Revision: 163
This commit is contained in:
tuomaspelkonen 2011-04-22 15:10:42 -07:00
parent 6a0234fed3
commit afedb711d9
4 changed files with 27 additions and 1 deletions

View file

@ -63,10 +63,23 @@ class ConduitAPI_differential_getrevision_Method extends ConduitAPIMethod {
ConduitAPI_differential_getdiff_Method::createDiffDict($diff);
}
$commit_dicts = array();
$commit_phids = $revision->loadCommitPHIDs();
$handles = id(new PhabricatorObjectHandleData($commit_phids))
->loadHandles();
foreach ($commit_phids as $commit_phid) {
$commit_dicts[] = array(
'fullname' => $handles[$commit_phid]->getFullName(),
'dateCommitted' => $handles[$commit_phid]->getTimestamp(),
);
}
$dict = array(
'id' => $revision->getID(),
'phid' => $revision->getPHID(),
'authorPHID' => $revision->getAuthorPHID(),
'uri' => PhabricatorEnv::getURI('/D'.$revision->getID()),
'title' => $revision->getTitle(),
'status' => $revision->getStatus(),
'statusName' => DifferentialRevisionStatus::getNameForRevisionStatus(
@ -75,10 +88,10 @@ class ConduitAPI_differential_getrevision_Method extends ConduitAPIMethod {
'testPlan' => $revision->getTestPlan(),
'revertPlan' => $revision->getRevertPlan(),
'blameRevision' => $revision->getBlameRevision(),
'dateCommitted' => $revision->getDateCommitted(),
'lineCount' => $revision->getLineCount(),
'reviewerPHIDs' => $reviewer_phids,
'diffs' => $diff_dicts,
'commits' => $commit_dicts,
);
return $dict;

View file

@ -11,6 +11,8 @@ phutil_require_module('phabricator', 'applications/conduit/method/differential/g
phutil_require_module('phabricator', 'applications/conduit/protocol/exception');
phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus');
phutil_require_module('phabricator', 'applications/differential/storage/revision');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phutil', 'utils');

View file

@ -25,6 +25,7 @@ class PhabricatorObjectHandle {
private $email;
private $fullName;
private $imageURI;
private $timestamp;
public function setURI($uri) {
$this->uri = $uri;
@ -92,6 +93,15 @@ class PhabricatorObjectHandle {
return $this->imageURI;
}
public function setTimestamp($timestamp) {
$this->timestamp = $timestamp;
return $this;
}
public function getTimestamp() {
return $this->timestamp;
}
public function renderLink() {
switch ($this->getType()) {

View file

@ -160,6 +160,7 @@ class PhabricatorObjectHandleData {
$handle->setName('Commit '.'r'.$callsign.$commit_identifier);
$handle->setURI('/r'.$callsign.$commit_identifier);
$handle->setFullName('r'.$callsign.$commit_identifier);
$handle->setTimestamp($commit->getEpoch());
}
$handles[$phid] = $handle;
}