phpci/PHPCI/Model/Build/MercurialBuild.php

49 lines
1.1 KiB
PHP
Raw Normal View History

2013-09-04 14:54:26 +02:00
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2013, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link http://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);
2013-09-04 14:54:26 +02:00
}
/**
* Use an mercurial clone.
*/
2013-10-10 02:01:06 +02:00
protected function cloneByHttp(Builder $builder, $cloneTo)
2013-09-04 14:54:26 +02:00
{
2013-10-10 02:01:06 +02:00
return $builder->executeCommand('hg clone %s "%s" -r %s', $this->getCloneUrl(), $cloneTo, $this->getBranch());
2013-09-04 14:54:26 +02:00
}
}