3 final class PhabricatorRepositoryVCSTransaction
4 extends PhabricatorRepositoryTransactionType
{
6 const TRANSACTIONTYPE
= 'repo:vcs';
8 public function generateOldValue($object) {
9 return $object->getVersionControlSystem();
12 public function applyInternalEffects($object, $value) {
13 $object->setVersionControlSystem($value);
16 public function validateTransactions($object, array $xactions) {
19 $vcs_map = PhabricatorRepositoryType
::getAllRepositoryTypes();
20 $current_vcs = $object->getVersionControlSystem();
22 if (!$this->isNewObject()) {
23 foreach ($xactions as $xaction) {
24 if ($xaction->getNewValue() == $current_vcs) {
28 $errors[] = $this->newInvalidError(
30 'You can not change the version control system an existing '.
31 'repository uses. It can only be set when a repository is '.
39 $value = $object->getVersionControlSystem();
41 foreach ($xactions as $xaction) {
42 $value = $xaction->getNewValue();
44 if (isset($vcs_map[$value])) {
48 $errors[] = $this->newInvalidError(
50 'Specified version control system must be a VCS '.
51 'recognized by this software. Valid systems are: %s.',
52 implode(', ', array_keys($vcs_map))),
56 if ($value === null) {
57 $errors[] = $this->newRequiredError(
59 'When creating a repository, you must specify a valid '.
60 'underlying version control system. Valid systems are: %s.',
61 implode(', ', array_keys($vcs_map))));