commit
9e146a275d
|
@ -87,7 +87,7 @@ class PollCommand extends Command
|
||||||
$build->setProjectId($project->getId());
|
$build->setProjectId($project->getId());
|
||||||
$build->setCommitId($last_commit);
|
$build->setCommitId($last_commit);
|
||||||
$build->setStatus(Build::STATUS_NEW);
|
$build->setStatus(Build::STATUS_NEW);
|
||||||
$build->setBranch($project->getType() === 'hg' ? 'default' : 'master');
|
$build->setBranch($project->getBranch());
|
||||||
$build->setCreated(new \DateTime());
|
$build->setCreated(new \DateTime());
|
||||||
if (!empty($last_committer)) {
|
if (!empty($last_committer)) {
|
||||||
$build->setCommitterEmail($last_committer);
|
$build->setCommitterEmail($last_committer);
|
||||||
|
|
|
@ -92,7 +92,7 @@ class ProjectController extends \PHPCI\Controller
|
||||||
$build->setProjectId($projectId);
|
$build->setProjectId($projectId);
|
||||||
$build->setCommitId('Manual');
|
$build->setCommitId('Manual');
|
||||||
$build->setStatus(Build::STATUS_NEW);
|
$build->setStatus(Build::STATUS_NEW);
|
||||||
$build->setBranch($project->getType() === 'hg' ? 'default' : 'master');
|
$build->setBranch($project->getBranch());
|
||||||
$build->setCreated(new \DateTime());
|
$build->setCreated(new \DateTime());
|
||||||
$build->setCommitterEmail($_SESSION['user']->getEmail());
|
$build->setCommitterEmail($_SESSION['user']->getEmail());
|
||||||
|
|
||||||
|
@ -319,6 +319,14 @@ class ProjectController extends \PHPCI\Controller
|
||||||
$field->setContainerClass('form-group');
|
$field->setContainerClass('form-group');
|
||||||
$form->addField($field);
|
$form->addField($field);
|
||||||
|
|
||||||
|
$field = new Form\Element\Text('branch');
|
||||||
|
$field->setRequired(true);
|
||||||
|
$field->setValidator($this->getReferenceValidator($values));
|
||||||
|
$field->setLabel('Branch name');
|
||||||
|
$field->setClass('form-control');
|
||||||
|
$field->setContainerClass('form-group');
|
||||||
|
$form->addField($field);
|
||||||
|
|
||||||
$field = new Form\Element\Text('title');
|
$field = new Form\Element\Text('title');
|
||||||
$field->setRequired(true);
|
$field->setRequired(true);
|
||||||
$field->setLabel('Project Title');
|
$field->setLabel('Project Title');
|
||||||
|
|
40
PHPCI/Migrations/20140611170618_choose_branch.php
Normal file
40
PHPCI/Migrations/20140611170618_choose_branch.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
class ChooseBranch extends AbstractMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Change Method.
|
||||||
|
*
|
||||||
|
* More information on this method is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/migrations.html#the-change-method
|
||||||
|
*
|
||||||
|
* Uncomment this method if you would like to use it.
|
||||||
|
*
|
||||||
|
public function change()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate Up.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$project = $this->table('project');
|
||||||
|
$project->addColumn('branch', 'string', array(
|
||||||
|
'after' => 'reference',
|
||||||
|
'limit' => 250
|
||||||
|
))->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate Down.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$project = $this->table('project');
|
||||||
|
$project->removeColumn('branch')->save();
|
||||||
|
}
|
||||||
|
}
|
|
@ -53,6 +53,7 @@ class ProjectBase extends Model
|
||||||
'id' => 'getId',
|
'id' => 'getId',
|
||||||
'title' => 'getTitle',
|
'title' => 'getTitle',
|
||||||
'reference' => 'getReference',
|
'reference' => 'getReference',
|
||||||
|
'branch' => 'getBranch',
|
||||||
'ssh_private_key' => 'getSshPrivateKey',
|
'ssh_private_key' => 'getSshPrivateKey',
|
||||||
'ssh_public_key' => 'getSshPublicKey',
|
'ssh_public_key' => 'getSshPublicKey',
|
||||||
'type' => 'getType',
|
'type' => 'getType',
|
||||||
|
@ -72,6 +73,7 @@ class ProjectBase extends Model
|
||||||
'id' => 'setId',
|
'id' => 'setId',
|
||||||
'title' => 'setTitle',
|
'title' => 'setTitle',
|
||||||
'reference' => 'setReference',
|
'reference' => 'setReference',
|
||||||
|
'branch' => 'setBranch',
|
||||||
'ssh_private_key' => 'setSshPrivateKey',
|
'ssh_private_key' => 'setSshPrivateKey',
|
||||||
'ssh_public_key' => 'setSshPublicKey',
|
'ssh_public_key' => 'setSshPublicKey',
|
||||||
'type' => 'setType',
|
'type' => 'setType',
|
||||||
|
@ -104,6 +106,11 @@ class ProjectBase extends Model
|
||||||
'length' => 250,
|
'length' => 250,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
),
|
),
|
||||||
|
'branch' => array(
|
||||||
|
'type' => 'varchar',
|
||||||
|
'length' => 250,
|
||||||
|
'default' => null,
|
||||||
|
),
|
||||||
'ssh_private_key' => array(
|
'ssh_private_key' => array(
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'nullable' => true,
|
'nullable' => true,
|
||||||
|
@ -192,6 +199,20 @@ class ProjectBase extends Model
|
||||||
return $rtn;
|
return $rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of Branch / branch.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBranch()
|
||||||
|
{
|
||||||
|
if (empty($this->data['branch'])) {
|
||||||
|
return $this->getType() === 'hg' ? 'default' : 'master';
|
||||||
|
} else {
|
||||||
|
return $this->data['branch'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of SshPrivateKey / ssh_private_key.
|
* Get the value of SshPrivateKey / ssh_private_key.
|
||||||
*
|
*
|
||||||
|
@ -336,6 +357,25 @@ class ProjectBase extends Model
|
||||||
$this->_setModified('reference');
|
$this->_setModified('reference');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of Branch / branch.
|
||||||
|
*
|
||||||
|
* Must not be null.
|
||||||
|
* @param $value string
|
||||||
|
*/
|
||||||
|
public function setBranch($value)
|
||||||
|
{
|
||||||
|
$this->_validateString('Branch', $value);
|
||||||
|
|
||||||
|
if ($this->data['branch'] === $value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->data['branch'] = $value;
|
||||||
|
|
||||||
|
$this->_setModified('branch');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of SshPrivateKey / ssh_private_key.
|
* Set the value of SshPrivateKey / ssh_private_key.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue