diff --git a/src/PHPCensor/Model/Build.php b/src/PHPCensor/Model/Build.php index 71403356..bcdf56fc 100644 --- a/src/PHPCensor/Model/Build.php +++ b/src/PHPCensor/Model/Build.php @@ -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) */ diff --git a/src/PHPCensor/Model/Build/BitbucketBuild.php b/src/PHPCensor/Model/Build/BitbucketBuild.php index b56ce4ca..b2ec12ff 100644 --- a/src/PHPCensor/Model/Build/BitbucketBuild.php +++ b/src/PHPCensor/Model/Build/BitbucketBuild.php @@ -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) * diff --git a/src/PHPCensor/Model/Build/BitbucketHgBuild.php b/src/PHPCensor/Model/Build/BitbucketHgBuild.php index d67dd2d8..6be40937 100644 --- a/src/PHPCensor/Model/Build/BitbucketHgBuild.php +++ b/src/PHPCensor/Model/Build/BitbucketHgBuild.php @@ -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. * diff --git a/src/PHPCensor/Model/Build/GithubBuild.php b/src/PHPCensor/Model/Build/GithubBuild.php index 911ade0c..be2b5d31 100644 --- a/src/PHPCensor/Model/Build/GithubBuild.php +++ b/src/PHPCensor/Model/Build/GithubBuild.php @@ -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 = '#$1'; + $commitLink = '#$1'; $rtn = preg_replace('/\#([0-9]+)/', $commitLink, $rtn); - $rtn = preg_replace('/\@([a-zA-Z0-9_]+)/', '@$1', $rtn); + $rtn = preg_replace('/\@([a-zA-Z0-9_]+)/', '@$1', $rtn); } return $rtn; diff --git a/src/PHPCensor/View/Build/errors.phtml b/src/PHPCensor/View/Build/errors.phtml index b5c080b3..09b068a2 100644 --- a/src/PHPCensor/View/Build/errors.phtml +++ b/src/PHPCensor/View/Build/errors.phtml @@ -24,9 +24,9 @@ foreach ($errors as $error):