Differential D14259 Diff 34449 src/applications/repository/storage/PhabricatorRepositoryTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepositoryTransaction.php
| Show All 22 Lines | final class PhabricatorRepositoryTransaction | ||||
| const TYPE_PUSH_POLICY = 'repo:push-policy'; | const TYPE_PUSH_POLICY = 'repo:push-policy'; | ||||
| const TYPE_CREDENTIAL = 'repo:credential'; | const TYPE_CREDENTIAL = 'repo:credential'; | ||||
| const TYPE_DANGEROUS = 'repo:dangerous'; | const TYPE_DANGEROUS = 'repo:dangerous'; | ||||
| const TYPE_CLONE_NAME = 'repo:clone-name'; | const TYPE_CLONE_NAME = 'repo:clone-name'; | ||||
| const TYPE_SERVICE = 'repo:service'; | const TYPE_SERVICE = 'repo:service'; | ||||
| const TYPE_SYMBOLS_SOURCES = 'repo:symbol-source'; | const TYPE_SYMBOLS_SOURCES = 'repo:symbol-source'; | ||||
| const TYPE_SYMBOLS_LANGUAGE = 'repo:symbol-language'; | const TYPE_SYMBOLS_LANGUAGE = 'repo:symbol-language'; | ||||
| const TYPE_STAGING_URI = 'repo:staging-uri'; | const TYPE_STAGING_URI = 'repo:staging-uri'; | ||||
| const TYPE_AUTOMATION_BLUEPRINTS = 'repo:automation-blueprints'; | |||||
| // TODO: Clean up these legacy transaction types. | // TODO: Clean up these legacy transaction types. | ||||
| const TYPE_SSH_LOGIN = 'repo:ssh-login'; | const TYPE_SSH_LOGIN = 'repo:ssh-login'; | ||||
| const TYPE_SSH_KEY = 'repo:ssh-key'; | const TYPE_SSH_KEY = 'repo:ssh-key'; | ||||
| const TYPE_SSH_KEYFILE = 'repo:ssh-keyfile'; | const TYPE_SSH_KEYFILE = 'repo:ssh-keyfile'; | ||||
| const TYPE_HTTP_LOGIN = 'repo:http-login'; | const TYPE_HTTP_LOGIN = 'repo:http-login'; | ||||
| const TYPE_HTTP_PASS = 'repo:http-pass'; | const TYPE_HTTP_PASS = 'repo:http-pass'; | ||||
| Show All 21 Lines | switch ($this->getTransactionType()) { | ||||
| if ($old) { | if ($old) { | ||||
| $phids[] = $old; | $phids[] = $old; | ||||
| } | } | ||||
| if ($new) { | if ($new) { | ||||
| $phids[] = $new; | $phids[] = $new; | ||||
| } | } | ||||
| break; | break; | ||||
| case self::TYPE_SYMBOLS_SOURCES: | case self::TYPE_SYMBOLS_SOURCES: | ||||
| case self::TYPE_AUTOMATION_BLUEPRINTS: | |||||
| if ($old) { | if ($old) { | ||||
| $phids = array_merge($phids, $old); | $phids = array_merge($phids, $old); | ||||
| } | } | ||||
| if ($new) { | if ($new) { | ||||
| $phids = array_merge($phids, $new); | $phids = array_merge($phids, $new); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 355 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
| } else { | } else { | ||||
| return pht( | return pht( | ||||
| '%s changed the staging area for this repository from '. | '%s changed the staging area for this repository from '. | ||||
| '"%s" to "%s".', | '"%s" to "%s".', | ||||
| $this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
| $old, | $old, | ||||
| $new); | $new); | ||||
| } | } | ||||
| case self::TYPE_AUTOMATION_BLUEPRINTS: | |||||
| $add = array_diff($new, $old); | |||||
| $rem = array_diff($old, $new); | |||||
| if ($add && $rem) { | |||||
| return pht( | |||||
| '%s changed %s automation blueprint(s), '. | |||||
| 'added %s: %s; removed %s: %s.', | |||||
| $this->renderHandleLink($author_phid), | |||||
| new PhutilNumber(count($add) + count($rem)), | |||||
| new PhutilNumber(count($add)), | |||||
| $this->renderHandleList($add), | |||||
| new PhutilNumber(count($rem)), | |||||
| $this->renderHandleList($rem)); | |||||
| } else if ($add) { | |||||
| return pht( | |||||
| '%s added %s automation blueprint(s): %s.', | |||||
| $this->renderHandleLink($author_phid), | |||||
| new PhutilNumber(count($add)), | |||||
| $this->renderHandleList($add)); | |||||
| } else { | |||||
| return pht( | |||||
| '%s removed %s automation blueprint(s): %s.', | |||||
| $this->renderHandleLink($author_phid), | |||||
| new PhutilNumber(count($rem)), | |||||
| $this->renderHandleList($rem)); | |||||
| } | |||||
| } | } | ||||
| return parent::getTitle(); | return parent::getTitle(); | ||||
| } | } | ||||
| public function hasChangeDetails() { | public function hasChangeDetails() { | ||||
| switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
| case self::TYPE_DESCRIPTION: | case self::TYPE_DESCRIPTION: | ||||
| Show All 13 Lines | |||||