FileLink is generated with commit id for github and bitbucket

fixes #89
This commit is contained in:
SimonHeimberg 2017-06-30 21:51:49 +02:00
parent 1ff7b1cdfe
commit 0ad8c4b327
3 changed files with 3 additions and 9 deletions

View file

@ -47,18 +47,16 @@ class BitbucketBuild extends RemoteGitBuild
public function getFileLinkTemplate()
{
$reference = $this->getProject()->getReference();
$branch = $this->getBranch();
if ($this->getExtra('build_type') == 'pull_request') {
$matches = [];
preg_match('/[\/:]([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra('remote_url'), $matches);
$reference = $matches[1];
$branch = $this->getExtra('remote_branch');
}
$link = 'https://bitbucket.org/' . $reference . '/';
$link .= 'src/' . $branch . '/';
$link .= 'src/' . $this->getCommitId() . '/';
$link .= '{FILE}';
$link .= '#{BASEFILE}-{LINE}';

View file

@ -47,18 +47,16 @@ class BitbucketHgBuild extends MercurialBuild
public function getFileLinkTemplate()
{
$reference = $this->getProject()->getReference();
$branch = $this->getBranch();
if ($this->getExtra('build_type') == 'pull_request') {
$matches = [];
preg_match('/[\/:]([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra('remote_url'), $matches);
$reference = $matches[1];
$branch = $this->getExtra('remote_branch');
}
$link = 'https://bitbucket.org/' . $reference . '/';
$link .= 'src/' . $branch . '/';
$link .= 'src/' . $this->getCommitId() . '/';
$link .= '{FILE}';
$link .= '#{BASEFILE}-{LINE}';

View file

@ -138,18 +138,16 @@ class GithubBuild extends RemoteGitBuild
public function getFileLinkTemplate()
{
$reference = $this->getProject()->getReference();
$branch = $this->getBranch();
if ($this->getExtra('build_type') == 'pull_request') {
$matches = [];
preg_match('/[\/:]([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra('remote_url'), $matches);
$reference = $matches[1];
$branch = $this->getExtra('remote_branch');
}
$link = 'https://github.com/' . $reference . '/';
$link .= 'blob/' . $branch . '/';
$link .= 'blob/' . $this->getCommitId() . '/';
$link .= '{FILE}';
$link .= '#L{LINE}-L{LINE_END}';