1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-29 00:40:57 +01:00

Display committed date in Revision Status field

Summary:
This is slightly more complicated for this reason:

- We don't set `dateCommitted` for normal commits, only for markcommitted.
-- We need to add this date to old revisions now.

Test Plan:
Reparse a revision - commit date was set.
Conduit `markcommitted` - commit date was set.
Run SQL script.
Display closed revision.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2282
This commit is contained in:
vrana 2012-04-19 00:17:58 -07:00
parent d9ce80aa17
commit 1f2cf78c1b
8 changed files with 36 additions and 7 deletions

View file

@ -0,0 +1,7 @@
UPDATE phabricator_differential.differential_revision SET
dateCommitted = (
SELECT MIN(dateCreated)
FROM phabricator_differential.differential_comment
WHERE revisionID = differential_revision.id AND action = 'commit'
)
WHERE status = 3 AND dateCommitted IS NULL;

View file

@ -68,10 +68,6 @@ final class ConduitAPI_differential_markcommitted_Method
DifferentialAction::ACTION_COMMIT);
$editor->save();
$revision->setStatus(ArcanistDifferentialRevisionStatus::COMMITTED);
$revision->setDateCommitted(time());
$revision->save();
return;
}

View file

@ -649,6 +649,8 @@ final class DifferentialRevisionViewController extends DifferentialController {
foreach ($aux_fields as $key => $aux_field) {
if (!$aux_field->shouldAppearOnRevisionView()) {
unset($aux_fields[$key]);
} else {
$aux_field->setUser($this->getRequest()->getUser());
}
}

View file

@ -352,6 +352,10 @@ final class DifferentialCommentEditor {
}
}
if (!$revision->getDateCommitted()) {
$revision->setDateCommitted(time());
}
$revision
->setStatus(ArcanistDifferentialRevisionStatus::COMMITTED);
break;

View file

@ -32,7 +32,8 @@ final class DifferentialRevisionStatusFieldSpecification
$diff = $this->getDiff();
$status = $revision->getStatus();
$next_step = null;
$info = null;
if ($status == ArcanistDifferentialRevisionStatus::ACCEPTED) {
switch ($diff->getSourceControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
@ -46,12 +47,17 @@ final class DifferentialRevisionStatusFieldSpecification
break;
}
if ($next_step) {
$next_step = ' · Next step: '.$next_step;
$info = ' · Next step: '.$next_step;
}
} else if ($status == ArcanistDifferentialRevisionStatus::CLOSED) {
$committed = $revision->getDateCommitted();
$info = ' ('.phabricator_datetime($committed, $this->getUser()).')';
}
$status =
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($status);
return '<strong>'.$status.'</strong>'.$next_step;
return '<strong>'.$status.'</strong>'.$info;
}
public function shouldAppearOnRevisionList() {

View file

@ -10,6 +10,7 @@ phutil_require_module('arcanist', 'differential/constants/revisionstatus');
phutil_require_module('phabricator', 'applications/differential/field/specification/base');
phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');
phutil_require_module('phabricator', 'view/utils');
phutil_require_source('DifferentialRevisionStatusFieldSpecification.php');

View file

@ -95,6 +95,12 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
if ($revision->getStatus() !=
ArcanistDifferentialRevisionStatus::COMMITTED) {
$date_committed = $this->getDateCommitted($commit);
if ($date_committed) {
$revision->setDateCommitted($date_committed);
}
$message = null;
$committer = $data->getCommitDetail('authorPHID');
if (!$committer) {
@ -112,6 +118,10 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
}
}
protected function getDateCommitted(PhabricatorRepositoryCommit $commit) {
return null;
}
/**
* When querying for revisions by hash, more than one revision may be found.
* This function identifies the "best" revision from such a set. Typically,

View file

@ -54,5 +54,8 @@ final class PhabricatorRepositorySvnCommitMessageParserWorker
return array();
}
protected function getDateCommitted(PhabricatorRepositoryCommit $commit) {
return $commit->getEpoch();
}
}