3 final class DrydockTestRepositoryOperation
4 extends DrydockRepositoryOperationType
{
6 const OPCONST
= 'test';
8 public function getOperationDescription(
9 DrydockRepositoryOperation
$operation,
10 PhabricatorUser
$viewer) {
11 return pht('Test Configuration');
14 public function getOperationCurrentStatus(
15 DrydockRepositoryOperation
$operation,
16 PhabricatorUser
$viewer) {
18 $repository = $operation->getRepository();
19 switch ($operation->getOperationState()) {
20 case DrydockRepositoryOperation
::STATE_WAIT
:
22 'Waiting to test configuration for %s...',
23 $repository->getMonogram());
24 case DrydockRepositoryOperation
::STATE_WORK
:
26 'Testing configuration for %s. This may take a moment if Drydock '.
27 'has to clone the repository for the first time.',
28 $repository->getMonogram());
29 case DrydockRepositoryOperation
::STATE_DONE
:
31 'Success! Automation is configured properly and Drydock can '.
33 $repository->getMonogram());
37 public function applyOperation(
38 DrydockRepositoryOperation
$operation,
39 DrydockInterface
$interface) {
40 $repository = $operation->getRepository();
42 if ($repository->isGit()) {
43 $interface->execx('git status');
44 } else if ($repository->isHg()) {
45 $interface->execx('hg status');
46 } else if ($repository->isSVN()) {
47 $interface->execx('svn status');
49 throw new PhutilMethodNotImplementedException();