phpci/PHPCI/Model/Build/MercurialBuild.php

49 lines
1.1 KiB
PHP

<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Model\Build;
use PHPCI\Model\Build;
use PHPCI\Builder;
/**
* Mercurial Build Model
* @author Pavel Gopanenko <pavelgopanenko@gmail.com>
* @package PHPCI
* @subpackage Core
*/
class MercurialBuild extends Build
{
/**
* Get the URL to be used to clone this remote repository.
*/
protected function getCloneUrl()
{
return $this->getProject()->getReference();
}
/**
* Create a working copy by cloning, copying, or similar.
*/
public function createWorkingCopy(Builder $builder, $buildPath)
{
$this->cloneByHttp($builder, $buildPath);
return $this->handleConfig($builder, $buildPath);
}
/**
* Use an mercurial clone.
*/
protected function cloneByHttp(Builder $builder, $cloneTo)
{
return $builder->executeCommand('hg clone %s "%s" -r %s', $this->getCloneUrl(), $cloneTo, $this->getBranch());
}
}