2013-03-15 12:28:43 +01:00
|
|
|
<?php
|
|
|
|
|
2013-07-21 18:27:00 +02:00
|
|
|
final class ReleephBranch extends ReleephDAO
|
Transactions - deploy buildTransactionTimeline to remaining applications
Summary:
Ref T4712. Specifically...
- Differential
- needed getApplicationTransactionViewObject() implemented
- Audit
- needed getApplicationTransactionViewObject() implemented
- Repository
- one object needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true)
- Ponder
- BONUS BUG FIX - leaving a comment on an answer had a bad redirect URI
- both PonderQuestion and PonderAnswer needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) on both "history" controllers
- left a "TODO" on buildAnswers on the question view controller, which is non-standard and should be re-written eventually
- Phortune
- BONUS BUG FIX - fix new user "createNewAccount" code to not fatal
- PhortuneAccount, PhortuneMerchant, and PhortuneCart needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) on Account view, merchant view, and cart view controller
- Fund
- Legalpad
- Nuance
- NuanceSource needed PhabricatorApplicationTransactionInterface implemented
- Releeph (this product is kind of a mess...)
- HACKQUEST - had to manually create an arcanist project to even be able to make a "product" and get started...!
- BONUS BUG FIX - make sure to "setName" on product edit
- ReleephProject (should be ReleepProduct...?), ReleephBranch, and ReleepRequest needed PhabricatorApplicationTransactionInterface implemented
- Harbormaster
- HarbormasterBuildable, HarbormasterBuild, HarbormasterBuildPlan, and HarbormasterBuildStep all needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) all over the place
Test Plan: foreach application, viewed the timeline(s) and made sure they still rendered
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T4712
Differential Revision: https://secure.phabricator.com/D10925
2014-12-04 00:35:47 +01:00
|
|
|
implements
|
|
|
|
PhabricatorApplicationTransactionInterface,
|
|
|
|
PhabricatorPolicyInterface {
|
2013-03-15 12:28:43 +01:00
|
|
|
|
|
|
|
protected $releephProjectID;
|
|
|
|
protected $isActive;
|
|
|
|
protected $createdByUserPHID;
|
|
|
|
|
|
|
|
// The immutable name of this branch ('releases/foo-2013.01.24')
|
|
|
|
protected $name;
|
|
|
|
protected $basename;
|
|
|
|
|
|
|
|
// The symbolic name of this branch (LATEST, PRODUCTION, RC, ...)
|
|
|
|
// See SYMBOLIC_NAME_NOTE below
|
|
|
|
protected $symbolicName;
|
|
|
|
|
|
|
|
// Where to cut the branch
|
|
|
|
protected $cutPointCommitPHID;
|
|
|
|
|
|
|
|
protected $details = array();
|
|
|
|
|
2013-07-21 18:27:00 +02:00
|
|
|
private $project = self::ATTACHABLE;
|
2013-08-14 18:01:38 +02:00
|
|
|
private $cutPointCommit = self::ATTACHABLE;
|
2013-07-21 18:27:00 +02:00
|
|
|
|
2015-01-13 20:47:05 +01:00
|
|
|
protected function getConfiguration() {
|
2013-03-15 12:28:43 +01:00
|
|
|
return array(
|
|
|
|
self::CONFIG_AUX_PHID => true,
|
|
|
|
self::CONFIG_SERIALIZATION => array(
|
|
|
|
'details' => self::SERIALIZATION_JSON,
|
|
|
|
),
|
2014-09-29 00:12:41 +02:00
|
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
|
|
'basename' => 'text64',
|
|
|
|
'isActive' => 'bool',
|
|
|
|
'symbolicName' => 'text64?',
|
|
|
|
'name' => 'text128',
|
|
|
|
),
|
|
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
|
|
'releephProjectID' => array(
|
|
|
|
'columns' => array('releephProjectID', 'symbolicName'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
'releephProjectID_2' => array(
|
|
|
|
'columns' => array('releephProjectID', 'basename'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
'releephProjectID_name' => array(
|
|
|
|
'columns' => array('releephProjectID', 'name'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
),
|
2013-03-15 12:28:43 +01:00
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function generatePHID() {
|
2014-07-24 00:05:46 +02:00
|
|
|
return PhabricatorPHID::generateNewPHID(ReleephBranchPHIDType::TYPECONST);
|
2013-03-15 12:28:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getDetail($key, $default = null) {
|
|
|
|
return idx($this->getDetails(), $key, $default);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDetail($key, $value) {
|
|
|
|
$this->details[$key] = $value;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-01-15 20:56:52 +01:00
|
|
|
protected function willWriteData(array &$data) {
|
2013-03-15 12:28:43 +01:00
|
|
|
// If symbolicName is omitted, set it to the basename.
|
|
|
|
//
|
|
|
|
// This means that we can enforce symbolicName as a UNIQUE column in the
|
2014-07-10 00:12:48 +02:00
|
|
|
// DB. We'll interpret symbolicName === basename as meaning "no symbolic
|
2013-03-15 12:28:43 +01:00
|
|
|
// name".
|
|
|
|
//
|
|
|
|
// SYMBOLIC_NAME_NOTE
|
|
|
|
if (!$data['symbolicName']) {
|
|
|
|
$data['symbolicName'] = $data['basename'];
|
|
|
|
}
|
|
|
|
parent::willWriteData($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSymbolicName() {
|
|
|
|
// See SYMBOLIC_NAME_NOTE above for why this is needed
|
|
|
|
if ($this->symbolicName == $this->getBasename()) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
return $this->symbolicName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setSymbolicName($name) {
|
|
|
|
if ($name) {
|
|
|
|
parent::setSymbolicName($name);
|
|
|
|
} else {
|
|
|
|
parent::setSymbolicName($this->getBasename());
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDisplayName() {
|
|
|
|
if ($sn = $this->getSymbolicName()) {
|
|
|
|
return $sn;
|
|
|
|
}
|
|
|
|
return $this->getBasename();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDisplayNameWithDetail() {
|
|
|
|
$n = $this->getBasename();
|
|
|
|
if ($sn = $this->getSymbolicName()) {
|
|
|
|
return "{$sn} ({$n})";
|
|
|
|
} else {
|
|
|
|
return $n;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getURI($path = null) {
|
|
|
|
$components = array(
|
2014-04-20 20:54:58 +02:00
|
|
|
'/releeph/branch',
|
|
|
|
$this->getID(),
|
|
|
|
$path,
|
2013-03-15 12:28:43 +01:00
|
|
|
);
|
2013-05-22 16:42:30 +02:00
|
|
|
return implode('/', $components);
|
2013-03-15 12:28:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function isActive() {
|
|
|
|
return $this->getIsActive();
|
|
|
|
}
|
|
|
|
|
2013-07-21 18:27:00 +02:00
|
|
|
public function attachProject(ReleephProject $project) {
|
|
|
|
$this->project = $project;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getProject() {
|
|
|
|
return $this->assertAttached($this->project);
|
|
|
|
}
|
|
|
|
|
2014-04-13 01:53:51 +02:00
|
|
|
public function getProduct() {
|
|
|
|
return $this->getProject();
|
|
|
|
}
|
|
|
|
|
2013-08-14 18:01:38 +02:00
|
|
|
public function attachCutPointCommit(
|
|
|
|
PhabricatorRepositoryCommit $commit = null) {
|
|
|
|
$this->cutPointCommit = $commit;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCutPointCommit() {
|
|
|
|
return $this->assertAttached($this->cutPointCommit);
|
|
|
|
}
|
|
|
|
|
2013-07-21 18:27:00 +02:00
|
|
|
|
Transactions - deploy buildTransactionTimeline to remaining applications
Summary:
Ref T4712. Specifically...
- Differential
- needed getApplicationTransactionViewObject() implemented
- Audit
- needed getApplicationTransactionViewObject() implemented
- Repository
- one object needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true)
- Ponder
- BONUS BUG FIX - leaving a comment on an answer had a bad redirect URI
- both PonderQuestion and PonderAnswer needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) on both "history" controllers
- left a "TODO" on buildAnswers on the question view controller, which is non-standard and should be re-written eventually
- Phortune
- BONUS BUG FIX - fix new user "createNewAccount" code to not fatal
- PhortuneAccount, PhortuneMerchant, and PhortuneCart needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) on Account view, merchant view, and cart view controller
- Fund
- Legalpad
- Nuance
- NuanceSource needed PhabricatorApplicationTransactionInterface implemented
- Releeph (this product is kind of a mess...)
- HACKQUEST - had to manually create an arcanist project to even be able to make a "product" and get started...!
- BONUS BUG FIX - make sure to "setName" on product edit
- ReleephProject (should be ReleepProduct...?), ReleephBranch, and ReleepRequest needed PhabricatorApplicationTransactionInterface implemented
- Harbormaster
- HarbormasterBuildable, HarbormasterBuild, HarbormasterBuildPlan, and HarbormasterBuildStep all needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) all over the place
Test Plan: foreach application, viewed the timeline(s) and made sure they still rendered
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T4712
Differential Revision: https://secure.phabricator.com/D10925
2014-12-04 00:35:47 +01:00
|
|
|
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getApplicationTransactionEditor() {
|
|
|
|
return new ReleephBranchEditor();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionObject() {
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionTemplate() {
|
|
|
|
return new ReleephBranchTransaction();
|
|
|
|
}
|
|
|
|
|
2014-12-04 22:58:52 +01:00
|
|
|
public function willRenderTimeline(
|
|
|
|
PhabricatorApplicationTransactionView $timeline,
|
|
|
|
AphrontRequest $request) {
|
|
|
|
|
|
|
|
return $timeline;
|
|
|
|
}
|
|
|
|
|
Transactions - deploy buildTransactionTimeline to remaining applications
Summary:
Ref T4712. Specifically...
- Differential
- needed getApplicationTransactionViewObject() implemented
- Audit
- needed getApplicationTransactionViewObject() implemented
- Repository
- one object needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true)
- Ponder
- BONUS BUG FIX - leaving a comment on an answer had a bad redirect URI
- both PonderQuestion and PonderAnswer needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) on both "history" controllers
- left a "TODO" on buildAnswers on the question view controller, which is non-standard and should be re-written eventually
- Phortune
- BONUS BUG FIX - fix new user "createNewAccount" code to not fatal
- PhortuneAccount, PhortuneMerchant, and PhortuneCart needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) on Account view, merchant view, and cart view controller
- Fund
- Legalpad
- Nuance
- NuanceSource needed PhabricatorApplicationTransactionInterface implemented
- Releeph (this product is kind of a mess...)
- HACKQUEST - had to manually create an arcanist project to even be able to make a "product" and get started...!
- BONUS BUG FIX - make sure to "setName" on product edit
- ReleephProject (should be ReleepProduct...?), ReleephBranch, and ReleepRequest needed PhabricatorApplicationTransactionInterface implemented
- Harbormaster
- HarbormasterBuildable, HarbormasterBuild, HarbormasterBuildPlan, and HarbormasterBuildStep all needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) all over the place
Test Plan: foreach application, viewed the timeline(s) and made sure they still rendered
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T4712
Differential Revision: https://secure.phabricator.com/D10925
2014-12-04 00:35:47 +01:00
|
|
|
|
2013-07-21 18:27:00 +02:00
|
|
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getCapabilities() {
|
2014-04-14 21:06:56 +02:00
|
|
|
return $this->getProduct()->getCapabilities();
|
2013-07-21 18:27:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getPolicy($capability) {
|
2014-04-14 21:06:56 +02:00
|
|
|
return $this->getProduct()->getPolicy($capability);
|
2013-07-21 18:27:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
2014-04-14 21:06:56 +02:00
|
|
|
return $this->getProduct()->hasAutomaticCapability($capability, $viewer);
|
2013-07-21 18:27:00 +02:00
|
|
|
}
|
|
|
|
|
2013-09-27 17:43:41 +02:00
|
|
|
public function describeAutomaticCapability($capability) {
|
2014-04-14 21:06:56 +02:00
|
|
|
return pht(
|
|
|
|
'Release branches have the same policies as the product they are a '.
|
|
|
|
'part of.');
|
2013-09-27 17:43:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-15 12:28:43 +01:00
|
|
|
}
|