2011-08-14 22:55:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2012-01-10 20:39:11 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-08-14 22:55:30 +02:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
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();
|
|
|
|
$next_step = null;
|
2012-01-10 20:39:11 +01:00
|
|
|
if ($status == ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
2011-08-14 22:55:30 +02:00
|
|
|
switch ($diff->getSourceControlSystem()) {
|
2012-01-24 18:00:39 +01:00
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
$next_step = '<tt>arc merge</tt>';
|
|
|
|
break;
|
2011-08-14 22:55:30 +02:00
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
2012-01-24 18:00:39 +01:00
|
|
|
$next_step = '<tt>arc amend</tt> or <tt>arc merge</tt>';
|
2011-08-14 22:55:30 +02:00
|
|
|
break;
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
2012-01-24 18:00:39 +01:00
|
|
|
$next_step = '<tt>arc commit</tt>';
|
2011-08-14 22:55:30 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ($next_step) {
|
2012-01-24 18:00:39 +01:00
|
|
|
$next_step = ' · Next step: '.$next_step;
|
2011-08-14 22:55:30 +02:00
|
|
|
}
|
|
|
|
}
|
2012-01-10 20:39:11 +01:00
|
|
|
$status =
|
|
|
|
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($status);
|
2011-08-14 22:55:30 +02:00
|
|
|
return '<strong>'.$status.'</strong>'.$next_step;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|