Add support for Bitbucket's Mercurial based repos
This commit is contained in:
parent
ea8c5393bc
commit
7084b49da7
9 changed files with 126 additions and 22 deletions
|
|
@ -332,19 +332,20 @@ class ProjectController extends PHPCensor\Controller
|
|||
$form->addField(new Form\Element\Hidden('pubkey'));
|
||||
|
||||
$options = [
|
||||
'choose' => Lang::get('select_repository_type'),
|
||||
'github' => 'GitHub',
|
||||
'bitbucket' => 'Bitbucket',
|
||||
'gitlab' => 'GitLab',
|
||||
'gogs' => 'Gogs',
|
||||
'remote' => 'Git',
|
||||
'local' => Lang::get('local'),
|
||||
'hg' => 'Mercurial (Hg)',
|
||||
'svn' => 'SVN',
|
||||
'choose' => Lang::get('select_repository_type'),
|
||||
'github' => 'GitHub',
|
||||
'bitbucket' => 'Bitbucket (Git)',
|
||||
'bitbuckethg' => 'Bitbucket (Hg)',
|
||||
'gitlab' => 'GitLab',
|
||||
'gogs' => 'Gogs',
|
||||
'remote' => 'Git',
|
||||
'local' => Lang::get('local'),
|
||||
'hg' => 'Mercurial (Hg)',
|
||||
'svn' => 'SVN',
|
||||
];
|
||||
|
||||
$field = Form\Element\Select::create('type', Lang::get('where_hosted'), true);
|
||||
$field->setPattern('^(github|bitbucket|gitlab|gogs|remote|local|hg|svn)');
|
||||
$field->setPattern('^(github|bitbucket|bitbuckethg|gitlab|gogs|remote|local|hg|svn)');
|
||||
$field->setOptions($options);
|
||||
$field->setClass('form-control')->setContainerClass('form-group');
|
||||
$form->addField($field);
|
||||
|
|
@ -428,7 +429,7 @@ class ProjectController extends PHPCensor\Controller
|
|||
|
||||
$validators = [
|
||||
'hg' => [
|
||||
'regex' => '/^(https?):\/\//',
|
||||
'regex' => '/^(ssh|https?):\/\//',
|
||||
'message' => Lang::get('error_mercurial')
|
||||
],
|
||||
'remote' => [
|
||||
|
|
@ -447,6 +448,10 @@ class ProjectController extends PHPCensor\Controller
|
|||
'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/',
|
||||
'message' => Lang::get('error_bitbucket')
|
||||
],
|
||||
'bitbuckethg' => [
|
||||
'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/',
|
||||
'message' => Lang::get('error_bitbucket')
|
||||
],
|
||||
];
|
||||
|
||||
if (in_array($type, $validators) && !preg_match($validators[$type]['regex'], $val)) {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class WebhookController extends Controller
|
|||
*/
|
||||
public function bitbucket($projectId)
|
||||
{
|
||||
$project = $this->fetchProject($projectId, ['bitbucket', 'remote']);
|
||||
$project = $this->fetchProject($projectId, ['bitbucket', 'bitbuckethg', 'remote']);
|
||||
|
||||
// Support both old services and new webhooks
|
||||
if ($payload = $this->getParam('payload')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue