From d98dda645e15f5e7fdabdb647b3555af3b47447b Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Wed, 27 May 2009 23:08:55 +0200 Subject: [PATCH] Pushed the constructor into the backend implementation. --- src/IDF/Scm.php | 8 -------- src/IDF/Scm/Git.php | 6 ++++++ src/IDF/Scm/Mercurial.php | 6 ++++++ src/IDF/Scm/Svn.php | 7 ++++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/IDF/Scm.php b/src/IDF/Scm.php index c97b97b..c027fbc 100644 --- a/src/IDF/Scm.php +++ b/src/IDF/Scm.php @@ -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. diff --git a/src/IDF/Scm/Git.php b/src/IDF/Scm/Git.php index cc028c0..048d857 100644 --- a/src/IDF/Scm/Git.php +++ b/src/IDF/Scm/Git.php @@ -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 { diff --git a/src/IDF/Scm/Mercurial.php b/src/IDF/Scm/Mercurial.php index a0371f7..ea985de 100644 --- a/src/IDF/Scm/Mercurial.php +++ b/src/IDF/Scm/Mercurial.php @@ -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); diff --git a/src/IDF/Scm/Svn.php b/src/IDF/Scm/Svn.php index 46a3cc7..30fdc78 100644 --- a/src/IDF/Scm/Svn.php +++ b/src/IDF/Scm/Svn.php @@ -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); } }