Pushed the constructor into the backend implementation.

This commit is contained in:
Loic d'Anterroches 2009-05-27 23:08:55 +02:00
parent 44ea8f1817
commit d98dda645e
4 changed files with 16 additions and 11 deletions

View File

@ -71,14 +71,6 @@ class IDF_Scm
*/
protected $cache = array();
/**
* Default constructor.
*/
public function __construct($repo, $project=null)
{
$this->repo = $repo;
$this->project = $project;
}
/**
* Returns an instance of the correct scm backend object.

View File

@ -35,6 +35,12 @@ class IDF_Scm_Git extends IDF_Scm
* *
* ============================================== */
public function __construct($repo, $project=null)
{
$this->repo = $repo;
$this->project = $project;
}
public function isAvailable()
{
try {

View File

@ -27,6 +27,12 @@
*/
class IDF_Scm_Mercurial extends IDF_Scm
{
public function __construct($repo, $project=null)
{
$this->repo = $repo;
$this->project = $project;
}
public static function factory($project)
{
$rep = sprintf(Pluf::f('mercurial_repositories'), $project->shortname);

View File

@ -41,9 +41,10 @@ class IDF_Scm_Svn extends IDF_Scm
private $commit=array();
public function __construct($repo, $username='', $password='')
public function __construct($repo, $project=null, $username='', $password='')
{
$this->repo = $repo;
$this->project = $project;
$this->username = $username;
$this->password = $password;
$this->cache['commitmess'] = array();
@ -115,12 +116,12 @@ class IDF_Scm_Svn extends IDF_Scm
if (false !== ($rep=$conf->getVal('svn_remote_url', false))
&& !empty($rep)) {
// Remote repository
return new IDF_Scm_Svn($rep,
return new IDF_Scm_Svn($rep, $project,
$conf->getVal('svn_username'),
$conf->getVal('svn_password'));
} else {
$rep = sprintf(Pluf::f('svn_repositories'), $project->shortname);
return new IDF_Scm_Svn($rep);
return new IDF_Scm_Svn($rep, $project);
}
}