Indefero

Indefero Commit Details


Date:2008-09-02 08:51:57 (16 years 3 months ago)
Author:Loic d'Anterroches
Branch:dev, develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3, svn
Commit:2d271f6b69de881074ce4feb6bea64af1ed82eba
Parents: 57a5b4738aeecf95080838f3baf2e69da9a5d77b
Message:Restructured one more time to be as SCM independent as possible.

The work is delegated as much as possible to the IDF_Scm_* classes.
Changes:

File differences

src/IDF/Project.php
3131
3232
3333
34
3435
3536
3637
38
3739
3840
3941
......
8991
9092
9193
92
94
9395
9496
9597
......
191193
192194
193195
194
195
196
196197
197198
198199
......
304305
305306
306307
307
308
308309
309
310310
311
311
312312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
313
314
315
316
317
349318
350319
351
352320
353321
354322
......
356324
357325
358326
327
359328
360
361
362329
363330
364331
......
378345
379346
380347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
381363
{
public $_model = __CLASS__;
public $_extra_cache = array();
protected $_pconf = null;
function init()
{
$this->_pconf = null;
$this->_extra_cache = array();
$this->_a['table'] = 'idf_projects';
$this->_a['model'] = __CLASS__;
return '';
}
function preSave($create=false)
{
if ($this->id == '') {
*/
public function getTagsFromConfig($cfg_key, $default, $dclass='Other')
{
$conf = new IDF_Conf();
$conf->setProject($this);
$conf = $this->getConf();
$tags = array();
foreach (preg_split("/\015\012|\015|\012/", $conf->getVal($cfg_key, $default), -1, PREG_SPLIT_NO_EMPTY) as $s) {
$_s = split('=', $s, 2);
}
/**
* Get the path to the git repository.
* Get the remote access url to the repository.
*
* @return string Path to the git repository
*/
public function getGitRepository()
public function getRemoteAccessUrl()
{
$gitrep = Pluf::f('git_repository');
if (substr($gitrep, -4) == '.git') {
return $gitrep;
}
// here we consider that the git_repository is a folder
// containing a series of git repositories
return $gitrep.'/'.$this->shortname.'.git';
}
/**
* Get the url to the repository through git daemon.
*
* @return string Path to the git daemon.
*/
public function getGitDaemonUrl()
{
$gitrep = Pluf::f('git_daemon_url');
if (substr($gitrep, -4) == '.git') {
return $gitrep;
}
// here we consider that the git_repository is a folder
// containing a series of git repositories
return $gitrep.'/'.$this->shortname.'.git';
}
/**
* Get the path to the git repository.
*
* @return string Path to the git repository
*/
public function getSvnDaemonUrl()
{
$conf = new IDF_Conf();
$conf->setProject($this);
return $conf->getVal('svn_daemon_url');
$conf = $this->getConf();
$scm = $conf->getVal('scm', 'git');
$scms = Pluf::f('allowed_scm');
return call_user_func(array($scms[$scm], 'getRemoteAccessUrl'),
$this);
}
/**
* Get the root name of the project scm
*
*/
public function getScmRoot()
{
$conf = $this->getConf();
$roots = array('git' => 'master', 'svn' => 'HEAD');
$conf = new IDF_Conf();
$conf->setProject($this);
$scm = $conf->getVal('scm', 'git');
return $roots[$scm];
}
throw new Pluf_HTTP_Error404();
}
}
/**
* Utility function to get a configuration object.
*
* @return IDF_Conf
*/
public function getConf()
{
if ($this->_pconf == null) {
$this->_pconf = new IDF_Conf();
$this->_pconf->setProject($this);
}
return $this->_pconf;
}
}
src/IDF/Scm.php
3535
3636
3737
38
39
40
41
42
43
44
45
46
38
39
40
41
4742
4843
4944
public static function get($request=null)
{
// Get scm type from project conf ; defaults to git
switch ($request->conf->getVal('scm', 'git')) {
case 'svn':
return new IDF_Scm_Svn($request->conf->getVal('svn_repository'),
$request->conf->getVal('svn_username'),
$request->conf->getVal('svn_password'));
case 'git':
default:
return new IDF_Scm_Git($request->project->getGitRepository());
}
$scm = $request->conf->getVal('scm', 'git');
$scms = Pluf::f('allowed_scm');
return call_user_func(array($scms[$scm], 'factory'),
$request->project);
}
}
src/IDF/Scm/Git.php
3535
3636
3737
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
3867
3968
4069
$this->repo = $repo;
}
/**
* Returns the URL of the git daemon.
*
* @param IDF_Project
* @return string URL
*/
public static function getRemoteAccessUrl($project)
{
$url = Pluf::f('git_remote_url');
if (Pluf::f('git_repositories_unique', true)) {
return $url;
}
return $url.'/'.$project->shortname.'.git';
}
/**
* Returns this object correctly initialized for the project.
*
* @param IDF_Project
* @return IDF_Scm_Git
*/
public static function factory($project)
{
$rep = Pluf::f('git_repositories');
if (false == Pluf::f('git_repositories_unique', false)) {
$rep = $rep.'/'.$project->shortname.'.git';
}
return new IDF_Scm_Git($rep);
}
/**
* Test a given object hash.
src/IDF/Scm/Svn.php
4141
4242
4343
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
4487
4588
4689
$this->password = $password;
}
/**
* Returns the URL of the subversion repository.
*
* @param IDF_Project
* @return string URL
*/
public static function getRemoteAccessUrl($project)
{
$conf = $project->getConf();
if (false !== ($url=$conf->getVal('svn_remote_url', false))) {
// Remote repository
return $url;
}
$url = Pluf::f('svn_remote_url');
if (Pluf::f('svn_repositories_unique', true)) {
return $url;
}
return $url.'/'.$project->shortname;
}
/**
* Returns this object correctly initialized for the project.
*
* @param IDF_Project
* @return IDF_Scm_Svn
*/
public static function factory($project)
{
$conf = $project->getConf();
// Find the repository
if (false !== ($rep=$conf->getVal('svn_remote_url', false))) {
// Remote repository
return new IDF_Scm_Svn($rep,
$conf->getVal('svn_username'),
$conf->getVal('svn_password'));
} else {
$rep = Pluf::f('svn_repositories');
if (false == Pluf::f('svn_repositories_unique', false)) {
$rep = $rep.'/'.$project->shortname;
}
return new IDF_Scm_Svn($rep);
}
}
/**
* Test a given object hash.
src/IDF/conf/idf.php-dist
2929
3030
3131
32
33
34
35
36
3237
3338
3439
3540
3641
3742
38
39
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
4058
41
42
43
44
4559
4660
4761
// available languages
$cfg['languages'] = array('en', 'fr');
# SCM base configuration
$cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git',
'svn' => 'IDF_Scm_Svn',
);
// if you have a single git repository, just put the full path to it
// without trailing slash.
// If within a folder you have a series of git repository, just put
// the folder without a trailing slash.
// InDefero will automatically append a slash, the project shortname
// and .git to create the name of the repository.
// $cfg['git_repository'] = '/home/git/repositories';
$cfg['git_repository'] = '/home/git/repositories/indefero.git';
$cfg['git_repositories'] = '/home/git/repositories/indefero.git';
$cfg['git_repositories_unique'] = true;
$cfg['git_remote_url'] = 'git://projects.ceondo.com/indefero.git';
// One git repository per project. "/".$project->shortname.".git"
// is automatically added to the end of the path/url.
//$cfg['git_repositories'] = '/home/git/repositories';
//$cfg['git_repositories_unique'] = false;
//$cfg['git_remote_url'] = 'git://projects.ceondo.com';
// Same as for git, you can have multiple repositories, one for each
// project or a single one for all the projects.
$cfg['svn_repositories'] = 'file:///home/svn/repositories/indefero';
$cfg['svn_repositories_unique'] = true;
$cfg['svn_remote_url'] = 'http://projects.ceondo.com/svn/indefero';
// As for the 'git_repository' case, you can either have it ending
// with .git in the case of a single repository or let it append
// '/'.$project_shortname.'.git' to make the path.
$cfg['git_daemon_url'] = 'git://projects.ceondo.com/indefero.git';
// admins will get an email in case of errors in the system in non
// debug mode.
src/IDF/templates/source/git/tree.html
4343
4444
4545
46
46
4747
4848
4949
</tbody>
</table>
{aurl 'url', 'IDF_Views_Source::download', array($project.shortname, $commit)}
<p class="right soft"><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/package-grey.png'}" alt="{trans 'Archive'}" align="bottom" /></a> <a href="{$url}">{trans 'Download this version'}</a> {trans 'or'} <kbd>git clone {$project.getGitDaemonUrl()}</kbd></p>
<p class="right soft"><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/package-grey.png'}" alt="{trans 'Archive'}" align="bottom" /></a> <a href="{$url}">{trans 'Download this version'}</a> {trans 'or'} <kbd>git clone {$project.getRemoteAccessUrl()}</kbd></p>
{/block}
src/IDF/templates/source/svn/tree.html
5656
5757
5858
59
59
6060
6161
6262
{/foreach}
</tbody>
</table>
<p class="right soft"><img style="vertical-align: text-bottom;" src="{media '/idf/img/package-grey.png'}" alt="{trans 'Archive'}" align="bottom" /> <kbd>svn checkout {$project.getSvnDaemonUrl()}@{$commit}</kbd></p>
<p class="right soft"><kbd>svn co -r {$commit} {$project.getRemoteAccessUrl()}</kbd></p>
{/block}

Archive Download the corresponding diff file

Page rendered in 0.10017s using 13 queries.