Added pull request remote branch to GUI.

This commit is contained in:
Dmitry Khomutov 2018-02-23 19:31:06 +07:00
commit 3400271bc5
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
9 changed files with 118 additions and 22 deletions

View file

@ -711,6 +711,22 @@ class Build extends Model
return '#';
}
/**
* Get remote branch (from pull request) from another source (i.e. Github)
*/
public function getRemoteBranch()
{
return $this->getExtra('remote_branch');
}
/**
* Get link to remote branch (from pull request) from another source (i.e. Github)
*/
public function getRemoteBranchLink()
{
return '#';
}
/**
* Get link to tag from another source (i.e. Github)
*/

View file

@ -37,6 +37,17 @@ class BitbucketBuild extends RemoteGitBuild
return 'https://bitbucket.org/' . $this->getProject()->getReference() . '/src/?at=' . $this->getBranch();
}
/**
* Get link to remote branch (from pull request) from another source (i.e. BitBucket)
*/
public function getRemoteBranchLink()
{
$remoteBranch = $this->getExtra('remote_branch');
$remoteReference = $this->getExtra('remote_reference');
return 'https://bitbucket.org/' . $remoteReference . '/src/?at=' . $remoteBranch;
}
/**
* Get link to tag from another source (i.e. BitBucket)
*

View file

@ -31,6 +31,27 @@ class BitbucketHgBuild extends MercurialBuild
return 'https://bitbucket.org/' . $this->getProject()->getReference() . '/src/?at=' . $this->getBranch();
}
/**
* Get link to remote branch (from pull request) from another source (i.e. BitBucket)
*/
public function getRemoteBranchLink()
{
$remoteBranch = $this->getExtra('remote_branch');
$remoteReference = $this->getExtra('remote_reference');
return 'https://bitbucket.org/' . $remoteReference . '/src/?at=' . $remoteBranch;
}
/**
* Get link to tag from another source (i.e. BitBucket)
*
* @return string
*/
public function getTagLink()
{
return 'https://bitbucket.org/' . $this->getProject()->getReference() . '/src/?at=' . $this->getTag();
}
/**
* Get the URL to be used to clone this remote repository.
*

View file

@ -37,6 +37,17 @@ class GithubBuild extends RemoteGitBuild
return 'https://github.com/' . $this->getProject()->getReference() . '/tree/' . $this->getBranch();
}
/**
* Get link to remote branch (from pull request) from another source (i.e. Github)
*/
public function getRemoteBranchLink()
{
$remoteBranch = $this->getExtra('remote_branch');
$remoteReference = $this->getExtra('remote_reference');
return 'https://github.com/' . $remoteReference . '/tree/' . $remoteBranch;
}
/**
* Get link to tag from another source (i.e. Github)
*
@ -151,9 +162,9 @@ class GithubBuild extends RemoteGitBuild
if (!is_null($project)) {
$reference = $project->getReference();
$commitLink = '<a target="_blank" href="https://github.com/' . $reference . '/issues/$1">#$1</a>';
$commitLink = '<a href="https://github.com/' . $reference . '/issues/$1">#$1</a>';
$rtn = preg_replace('/\#([0-9]+)/', $commitLink, $rtn);
$rtn = preg_replace('/\@([a-zA-Z0-9_]+)/', '<a target="_blank" href="https://github.com/$1">@$1</a>', $rtn);
$rtn = preg_replace('/\@([a-zA-Z0-9_]+)/', '<a href="https://github.com/$1">@$1</a>', $rtn);
}
return $rtn;