2011-08-14 22:55:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialRevisionStatusFieldSpecification
|
|
|
|
extends DifferentialFieldSpecification {
|
|
|
|
|
|
|
|
public function shouldAppearOnRevisionView() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderLabelForRevisionView() {
|
|
|
|
return 'Revision Status:';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderValueForRevisionView() {
|
|
|
|
$revision = $this->getRevision();
|
|
|
|
$diff = $this->getDiff();
|
|
|
|
|
|
|
|
$status = $revision->getStatus();
|
2012-04-19 09:17:58 +02:00
|
|
|
$info = null;
|
2012-05-01 20:30:02 +02:00
|
|
|
$local_vcs = $diff->getSourceControlSystem();
|
|
|
|
$backing_vcs = $diff->getBackingVersionControlSystem();
|
2012-05-03 02:26:09 +02:00
|
|
|
if (!$backing_vcs) {
|
|
|
|
$backing_vcs = $local_vcs;
|
|
|
|
}
|
2012-04-19 09:17:58 +02:00
|
|
|
|
2012-01-10 20:39:11 +01:00
|
|
|
if ($status == ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
2012-05-10 20:43:35 +02:00
|
|
|
$next_step = null;
|
2012-05-01 20:30:02 +02:00
|
|
|
if ($local_vcs == $backing_vcs) {
|
|
|
|
switch ($local_vcs) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
$next_step = '<tt>hg push</tt>';
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
$next_step = '<tt>arc land</tt>';
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
$next_step = '<tt>arc commit</tt>';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$next_step = '<tt>arc amend</tt>';
|
2011-08-14 22:55:30 +02:00
|
|
|
}
|
|
|
|
if ($next_step) {
|
2012-04-19 09:17:58 +02:00
|
|
|
$info = ' · Next step: '.$next_step;
|
2011-08-14 22:55:30 +02:00
|
|
|
}
|
2012-04-19 09:17:58 +02:00
|
|
|
} else if ($status == ArcanistDifferentialRevisionStatus::CLOSED) {
|
|
|
|
$committed = $revision->getDateCommitted();
|
2012-05-10 20:43:35 +02:00
|
|
|
if ($committed) {
|
|
|
|
$verb = null;
|
|
|
|
switch ($backing_vcs) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
$verb = 'Pushed';
|
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
$verb = 'Committed';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ($verb) {
|
|
|
|
$when = phabricator_datetime($committed, $this->getUser());
|
|
|
|
$info = " ({$verb} {$when})";
|
|
|
|
}
|
Clarify "Closed" revision status with VCS-specific language
Summary: Instead of rendering "Revision Status: Closed (Sat, Apr 28, 10:28 AM)", render "Revision Status: Closed (Pushed Sat, Apr 28, 10:28 AM)", or "Committed", as appropriate.
Test Plan: Looked at a committed revision.
Reviewers: btrahan, vrana, jungejason
Reviewed By: jungejason
CC: jeffmo, rdbayer, aran
Maniphest Tasks: T909
Differential Revision: https://secure.phabricator.com/D2334
2012-04-28 23:10:39 +02:00
|
|
|
}
|
2011-08-14 22:55:30 +02:00
|
|
|
}
|
2012-04-19 09:17:58 +02:00
|
|
|
|
2012-01-10 20:39:11 +01:00
|
|
|
$status =
|
|
|
|
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($status);
|
2012-04-19 09:17:58 +02:00
|
|
|
return '<strong>'.$status.'</strong>'.$info;
|
2011-08-14 22:55:30 +02:00
|
|
|
}
|
|
|
|
|
2012-02-20 14:38:21 +01:00
|
|
|
public function shouldAppearOnRevisionList() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderHeaderForRevisionList() {
|
|
|
|
return 'Status';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderValueForRevisionList(DifferentialRevision $revision) {
|
|
|
|
return ArcanistDifferentialRevisionStatus::getNameForRevisionStatus(
|
|
|
|
$revision->getStatus());
|
|
|
|
}
|
|
|
|
|
2011-08-14 22:55:30 +02:00
|
|
|
}
|