@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at recaptime-dev/main 53 lines 1.6 kB view raw
1<?php 2 3final class DrydockTestRepositoryOperation 4 extends DrydockRepositoryOperationType { 5 6 const OPCONST = 'test'; 7 8 public function getOperationDescription( 9 DrydockRepositoryOperation $operation, 10 PhabricatorUser $viewer) { 11 return pht('Test Configuration'); 12 } 13 14 public function getOperationCurrentStatus( 15 DrydockRepositoryOperation $operation, 16 PhabricatorUser $viewer) { 17 18 $repository = $operation->getRepository(); 19 switch ($operation->getOperationState()) { 20 case DrydockRepositoryOperation::STATE_WAIT: 21 return pht( 22 'Waiting to test configuration for %s...', 23 $repository->getMonogram()); 24 case DrydockRepositoryOperation::STATE_WORK: 25 return pht( 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: 30 return pht( 31 'Success! Automation is configured properly and Drydock can '. 32 'operate on %s.', 33 $repository->getMonogram()); 34 } 35 } 36 37 public function applyOperation( 38 DrydockRepositoryOperation $operation, 39 DrydockInterface $interface) { 40 $repository = $operation->getRepository(); 41 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'); 48 } else { 49 throw new PhutilMethodNotImplementedException(); 50 } 51 } 52 53}