Indefero

Indefero Commit Details


Date:2008-09-01 14:42:18 (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:57a5b4738aeecf95080838f3baf2e69da9a5d77b
Parents: fad12e17c7b5bba26689c2e60d32d492915c895a
Message:Restructured the file hierarchy.

Git and Svn are now in a Scm subfolder.
Changes:

File differences

src/IDF/Git.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008 CĂ©ondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* Git utils.
*
*/
class IDF_Git
{
public $repo = '';
public $mediumtree_fmt = 'commit %H%nAuthor: %an <%ae>%nTree: %T%nDate: %ai%n%n%s%n%n%b';
public function __construct($repo)
{
$this->repo = $repo;
}
/**
* Test a given object hash.
*
* @param string Object hash.
* @param null to be svn client compatible
* @return mixed false if not valid or 'blob', 'tree', 'commit'
*/
public function testHash($hash, $dummy=null)
{
$cmd = sprintf('GIT_DIR=%s git cat-file -t %s',
escapeshellarg($this->repo),
escapeshellarg($hash));
$ret = 0; $out = array();
exec($cmd, &$out, &$ret);
if ($ret != 0) return false;
return trim($out[0]);
}
/**
* Given a commit hash returns an array of files in it.
*
* A file is a class with the following properties:
*
* 'perm', 'type', 'size', 'hash', 'file'
*
* @param string Commit ('HEAD')
* @param string Base folder ('')
* @return array
*/
public function filesAtCommit($commit='HEAD', $folder='')
{
// now we grab the info about this commit including its tree.
$co = $this->getCommit($commit);
if ($folder) {
// As we are limiting to a given folder, we need to find
// the tree corresponding to this folder.
$found = false;
foreach ($this->getTreeInfo($co->tree) as $file) {
if ($file->type == 'tree' and $file->file == $folder) {
$found = true;
$tree = $file->hash;
break;
}
}
if (!$found) {
throw new Exception(sprintf(__('Folder %1$s not found in commit %2$s.'), $folder, $commit));
}
} else {
$tree = $co->tree;
}
$res = array();
// get the raw log corresponding to this commit to find the
// origin of each file.
$rawlog = array();
$cmd = sprintf('GIT_DIR=%s git log --raw --abbrev=40 --pretty=oneline %s',
escapeshellarg($this->repo), escapeshellarg($commit));
exec($cmd, &$rawlog);
// We reverse the log to be able to use a fixed efficient
// regex without back tracking.
$rawlog = implode("\n", array_reverse($rawlog));
foreach ($this->getTreeInfo($tree, false) as $file) {
// Now we grab the files in the current tree with as much
// information as possible.
$matches = array();
if ($file->type == 'blob' and preg_match('/^\:\d{6} \d{6} [0-9a-f]{40} '.$file->hash.' .*^([0-9a-f]{40})/msU',
$rawlog, &$matches)) {
$fc = $this->getCommit($matches[1]);
$file->date = $fc->date;
$file->log = $fc->title;
} else if ($file->type == 'blob') {
$file->date = $co->date;
$file->log = $co->title;
}
$file->fullpath = ($folder) ? $folder.'/'.$file->file : $file->file;
$res[] = $file;
}
return $res;
}
/**
* Get the tree info.
*
* @param string Tree hash
* @param bool Do we recurse in subtrees (true)
* @return array Array of file information.
*/
public function getTreeInfo($tree, $recurse=true)
{
if ('tree' != $this->testHash($tree)) {
throw new Exception(sprintf(__('Not a valid tree: %s.'), $tree));
}
$cmd_tmpl = 'GIT_DIR=%s git-ls-tree%s -t -l %s';
$cmd = sprintf($cmd_tmpl,
escapeshellarg($this->repo),
($recurse) ? ' -r' : '',
escapeshellarg($tree));
$out = array();
$res = array();
exec($cmd, &$out);
foreach ($out as $line) {
list($perm, $type, $hash, $size, $file) = preg_split('/ |\t/', $line, 5, PREG_SPLIT_NO_EMPTY);
$res[] = (object) array('perm' => $perm, 'type' => $type,
'size' => $size, 'hash' => $hash,
'file' => $file);
}
return $res;
}
/**
* Get the file info.
*
* @param string File
* @param string Commit ('HEAD')
* @return false Information
*/
public function getFileInfo($totest, $commit='HEAD')
{
$cmd_tmpl = 'GIT_DIR=%s git-ls-tree -r -t -l %s';
$cmd = sprintf($cmd_tmpl,
escapeshellarg($this->repo),
escapeshellarg($commit));
$out = array();
exec($cmd, &$out);
foreach ($out as $line) {
list($perm, $type, $hash, $size, $file) = preg_split('/ |\t/', $line, 5, PREG_SPLIT_NO_EMPTY);
if ($totest == $file) {
return (object) array('perm' => $perm, 'type' => $type,
'size' => $size, 'hash' => $hash,
'file' => $file);
}
}
return false;
}
/**
* Get a blob.
*
* @param string Blob hash
* @return string Raw blob
*/
public function getBlob($hash)
{
return shell_exec(sprintf('GIT_DIR=%s git-cat-file blob %s',
escapeshellarg($this->repo),
escapeshellarg($hash)));
}
/**
* Get the branches.
*
* @return array Branches.
*/
public function getBranches()
{
$out = array();
exec(sprintf('GIT_DIR=%s git branch',
escapeshellarg($this->repo)), &$out);
$res = array();
foreach ($out as $b) {
$res[] = substr($b, 2);
}
return $res;
}
/**
* Get commit details.
*
* @param string Commit ('HEAD').
* @return array Changes.
*/
public function getCommit($commit='HEAD')
{
$cmd = sprintf('GIT_DIR=%s git show --date=iso --pretty=format:%s %s',
escapeshellarg($this->repo),
"'".$this->mediumtree_fmt."'",
escapeshellarg($commit));
$out = array();
exec($cmd, &$out);
$log = array();
$change = array();
$inchange = false;
foreach ($out as $line) {
if (!$inchange and 0 === strpos($line, 'diff --git a')) {
$inchange = true;
}
if ($inchange) {
$change[] = $line;
} else {
$log[] = $line;
}
}
$out = self::parseLog($log, 4);
$out[0]->changes = implode("\n", $change);
return $out[0];
}
/**
* Get latest changes.
*
* @param string Commit ('HEAD').
* @param int Number of changes (10).
* @return array Changes.
*/
public function getChangeLog($commit='HEAD', $n=10)
{
if ($n === null) $n = '';
else $n = ' -'.$n;
$cmd = sprintf('GIT_DIR=%s git log%s --date=iso --pretty=format:\'%s\' %s',
escapeshellarg($this->repo), $n, $this->mediumtree_fmt,
escapeshellarg($commit));
$out = array();
exec($cmd, &$out);
return self::parseLog($out, 4);
}
/**
* Parse the log lines of a --pretty=medium log output.
*
* @param array Lines.
* @param int Number of lines in the headers (3)
* @return array Change log.
*/
public static function parseLog($lines, $hdrs=3)
{
$res = array();
$c = array();
$i = 0;
$hdrs += 2;
foreach ($lines as $line) {
$i++;
if (0 === strpos($line, 'commit')) {
if (count($c) > 0) {
$c['full_message'] = trim($c['full_message']);
$res[] = (object) $c;
}
$c = array();
$c['commit'] = trim(substr($line, 7));
$c['full_message'] = '';
$i=1;
continue;
}
if ($i == $hdrs) {
$c['title'] = trim($line);
continue;
}
$match = array();
if (preg_match('/(\S+)\s*:\s*(.*)/', $line, $match)) {
$match[1] = strtolower($match[1]);
$c[$match[1]] = trim($match[2]);
if ($match[1] == 'date') {
$c['date'] = gmdate('Y-m-d H:i:s', strtotime($match[2]));
}
continue;
}
if ($i > ($hdrs+1)) {
$c['full_message'] .= trim($line)."\n";
continue;
}
}
$c['full_message'] = trim($c['full_message']);
$res[] = (object) $c;
return $res;
}
/**
* Generate the command to create a zip archive at a given commit.
*
* @param string Commit
* @param string Prefix ('git-repo-dump')
* @return string Command
*/
public function getArchiveCommand($commit, $prefix='git-repo-dump/')
{
return sprintf('GIT_DIR=%s git archive --format=zip --prefix=%s %s',
escapeshellarg($this->repo),
escapeshellarg($prefix),
escapeshellarg($commit));
}
}
src/IDF/Scm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008 CĂ©ondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* Manage differents SCM systems
*/
class IDF_Scm
{
/**
* Returns an instance of the correct scm backend object.
*
* @return Object
*/
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());
}
}
}
src/IDF/Scm/Git.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008 CĂ©ondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* Git utils.
*
*/
class IDF_Scm_Git
{
public $repo = '';
public $mediumtree_fmt = 'commit %H%nAuthor: %an <%ae>%nTree: %T%nDate: %ai%n%n%s%n%n%b';
public function __construct($repo)
{
$this->repo = $repo;
}
/**
* Test a given object hash.
*
* @param string Object hash.
* @param null to be svn client compatible
* @return mixed false if not valid or 'blob', 'tree', 'commit'
*/
public function testHash($hash, $dummy=null)
{
$cmd = sprintf('GIT_DIR=%s git cat-file -t %s',
escapeshellarg($this->repo),
escapeshellarg($hash));
$ret = 0; $out = array();
exec($cmd, &$out, &$ret);
if ($ret != 0) return false;
return trim($out[0]);
}
/**
* Given a commit hash returns an array of files in it.
*
* A file is a class with the following properties:
*
* 'perm', 'type', 'size', 'hash', 'file'
*
* @param string Commit ('HEAD')
* @param string Base folder ('')
* @return array
*/
public function filesAtCommit($commit='HEAD', $folder='')
{
// now we grab the info about this commit including its tree.
$co = $this->getCommit($commit);
if ($folder) {
// As we are limiting to a given folder, we need to find
// the tree corresponding to this folder.
$found = false;
foreach ($this->getTreeInfo($co->tree) as $file) {
if ($file->type == 'tree' and $file->file == $folder) {
$found = true;
$tree = $file->hash;
break;
}
}
if (!$found) {
throw new Exception(sprintf(__('Folder %1$s not found in commit %2$s.'), $folder, $commit));
}
} else {
$tree = $co->tree;
}
$res = array();
// get the raw log corresponding to this commit to find the
// origin of each file.
$rawlog = array();
$cmd = sprintf('GIT_DIR=%s git log --raw --abbrev=40 --pretty=oneline %s',
escapeshellarg($this->repo), escapeshellarg($commit));
exec($cmd, &$rawlog);
// We reverse the log to be able to use a fixed efficient
// regex without back tracking.
$rawlog = implode("\n", array_reverse($rawlog));
foreach ($this->getTreeInfo($tree, false) as $file) {
// Now we grab the files in the current tree with as much
// information as possible.
$matches = array();
if ($file->type == 'blob' and preg_match('/^\:\d{6} \d{6} [0-9a-f]{40} '.$file->hash.' .*^([0-9a-f]{40})/msU',
$rawlog, &$matches)) {
$fc = $this->getCommit($matches[1]);
$file->date = $fc->date;
$file->log = $fc->title;
} else if ($file->type == 'blob') {
$file->date = $co->date;
$file->log = $co->title;
}
$file->fullpath = ($folder) ? $folder.'/'.$file->file : $file->file;
$res[] = $file;
}
return $res;
}
/**
* Get the tree info.
*
* @param string Tree hash
* @param bool Do we recurse in subtrees (true)
* @return array Array of file information.
*/
public function getTreeInfo($tree, $recurse=true)
{
if ('tree' != $this->testHash($tree)) {
throw new Exception(sprintf(__('Not a valid tree: %s.'), $tree));
}
$cmd_tmpl = 'GIT_DIR=%s git-ls-tree%s -t -l %s';
$cmd = sprintf($cmd_tmpl,
escapeshellarg($this->repo),
($recurse) ? ' -r' : '',
escapeshellarg($tree));
$out = array();
$res = array();
exec($cmd, &$out);
foreach ($out as $line) {
list($perm, $type, $hash, $size, $file) = preg_split('/ |\t/', $line, 5, PREG_SPLIT_NO_EMPTY);
$res[] = (object) array('perm' => $perm, 'type' => $type,
'size' => $size, 'hash' => $hash,
'file' => $file);
}
return $res;
}
/**
* Get the file info.
*
* @param string File
* @param string Commit ('HEAD')
* @return false Information
*/
public function getFileInfo($totest, $commit='HEAD')
{
$cmd_tmpl = 'GIT_DIR=%s git-ls-tree -r -t -l %s';
$cmd = sprintf($cmd_tmpl,
escapeshellarg($this->repo),
escapeshellarg($commit));
$out = array();
exec($cmd, &$out);
foreach ($out as $line) {
list($perm, $type, $hash, $size, $file) = preg_split('/ |\t/', $line, 5, PREG_SPLIT_NO_EMPTY);
if ($totest == $file) {
return (object) array('perm' => $perm, 'type' => $type,
'size' => $size, 'hash' => $hash,
'file' => $file);
}
}
return false;
}
/**
* Get a blob.
*
* @param string Blob hash
* @return string Raw blob
*/
public function getBlob($hash)
{
return shell_exec(sprintf('GIT_DIR=%s git-cat-file blob %s',
escapeshellarg($this->repo),
escapeshellarg($hash)));
}
/**
* Get the branches.
*
* @return array Branches.
*/
public function getBranches()
{
$out = array();
exec(sprintf('GIT_DIR=%s git branch',
escapeshellarg($this->repo)), &$out);
$res = array();
foreach ($out as $b) {
$res[] = substr($b, 2);
}
return $res;
}
/**
* Get commit details.
*
* @param string Commit ('HEAD').
* @return array Changes.
*/
public function getCommit($commit='HEAD')
{
$cmd = sprintf('GIT_DIR=%s git show --date=iso --pretty=format:%s %s',
escapeshellarg($this->repo),
"'".$this->mediumtree_fmt."'",
escapeshellarg($commit));
$out = array();
exec($cmd, &$out);
$log = array();
$change = array();
$inchange = false;
foreach ($out as $line) {
if (!$inchange and 0 === strpos($line, 'diff --git a')) {
$inchange = true;
}
if ($inchange) {
$change[] = $line;
} else {
$log[] = $line;
}
}
$out = self::parseLog($log, 4);
$out[0]->changes = implode("\n", $change);
return $out[0];
}
/**
* Get latest changes.
*
* @param string Commit ('HEAD').
* @param int Number of changes (10).
* @return array Changes.
*/
public function getChangeLog($commit='HEAD', $n=10)
{
if ($n === null) $n = '';
else $n = ' -'.$n;
$cmd = sprintf('GIT_DIR=%s git log%s --date=iso --pretty=format:\'%s\' %s',
escapeshellarg($this->repo), $n, $this->mediumtree_fmt,
escapeshellarg($commit));
$out = array();
exec($cmd, &$out);
return self::parseLog($out, 4);
}
/**
* Parse the log lines of a --pretty=medium log output.
*
* @param array Lines.
* @param int Number of lines in the headers (3)
* @return array Change log.
*/
public static function parseLog($lines, $hdrs=3)
{
$res = array();
$c = array();
$i = 0;
$hdrs += 2;
foreach ($lines as $line) {
$i++;
if (0 === strpos($line, 'commit')) {
if (count($c) > 0) {
$c['full_message'] = trim($c['full_message']);
$res[] = (object) $c;
}
$c = array();
$c['commit'] = trim(substr($line, 7));
$c['full_message'] = '';
$i=1;
continue;
}
if ($i == $hdrs) {
$c['title'] = trim($line);
continue;
}
$match = array();
if (preg_match('/(\S+)\s*:\s*(.*)/', $line, $match)) {
$match[1] = strtolower($match[1]);
$c[$match[1]] = trim($match[2]);
if ($match[1] == 'date') {
$c['date'] = gmdate('Y-m-d H:i:s', strtotime($match[2]));
}
continue;
}
if ($i > ($hdrs+1)) {
$c['full_message'] .= trim($line)."\n";
continue;
}
}
$c['full_message'] = trim($c['full_message']);
$res[] = (object) $c;
return $res;
}
/**
* Generate the command to create a zip archive at a given commit.
*
* @param string Commit
* @param string Prefix ('git-repo-dump')
* @return string Command
*/
public function getArchiveCommand($commit, $prefix='git-repo-dump/')
{
return sprintf('GIT_DIR=%s git archive --format=zip --prefix=%s %s',
escapeshellarg($this->repo),
escapeshellarg($prefix),
escapeshellarg($commit));
}
}
src/IDF/Scm/Svn.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008 CĂ©ondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* SVN utils.
*
*/
class IDF_Scm_Svn
{
public $repo = '';
public $username = '';
public $password = '';
private $assoc = array('dir' => 'tree',
'file' => 'blob');
public function __construct($repo, $username='', $password='')
{
$this->repo = $repo;
$this->username = $username;
$this->password = $password;
}
/**
* Test a given object hash.
*
* @param string Object hash.
* @return mixed false if not valid or 'blob', 'tree', 'commit'
*/
public function testHash($rev, $path='')
{
// OK if HEAD on /
if ($rev === 'HEAD' && $path === '') {
return 'commit';
}
// Else, test the path on revision
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlInfo = shell_exec($cmd);
// If exception is thrown, return false
try {
$xml = simplexml_load_string($xmlInfo);
}
catch (Exception $e) {
return false;
}
// If the entry node does exists, params are wrong
if (!isset($xml->entry)) {
return false;
}
// Else, enjoy it :)
return 'commit';
}
/**
* Given a commit hash returns an array of files in it.
*
* A file is a class with the following properties:
*
* 'perm', 'type', 'size', 'hash', 'file'
*
* @param string Commit ('HEAD')
* @param string Base folder ('')
* @return array
*/
public function filesAtCommit($rev='HEAD', $folder='')
{
$cmd = sprintf('svn ls --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$folder),
escapeshellarg($rev));
$xmlLs = shell_exec($cmd);
$xml = simplexml_load_string($xmlLs);
$res = array();
foreach ($xml->list->entry as $entry) {
$file = array();
$file['type'] = $this->assoc[(string) $entry['kind']];
$file['file'] = (string) $entry->name;
$file['fullpath'] = $folder.'/'.((string) $entry->name);
$file['date'] = gmdate('Y-m-d H:i:s',
strtotime((string) $entry->commit->date));
$file['rev'] = (string) $entry->commit['revision'];
// Get commit message
$currentReposFile = $this->repo.'/'.$folder.'/'.$file['file'];
$file['log'] = $this->getCommitMessage($currentReposFile, $rev);
// Get the size if the type is blob
if ($file['type'] == 'blob') {
$file['size'] = (string) $entry->size;
}
$file['perm'] = '';
$res[] = (object) $file;
}
return $res;
}
/**
* Get a commit message for given file and revision.
*
* @param string File
* @param string Commit ('HEAD')
*
* @return String commit message
*/
private function getCommitMessage($file, $rev='HEAD')
{
$cmd = sprintf('svn log --xml --limit 1 --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($file),
escapeshellarg($rev));
$xmlLog = shell_exec($cmd);
$xml = simplexml_load_string($xmlLog);
return (string) $xml->logentry->msg;
}
/**
* Get the file info.
*
* @param string File
* @param string Commit ('HEAD')
* @return false Information
*/
public function getFileInfo($totest, $rev='HEAD')
{
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$totest),
escapeshellarg($rev));
$xmlInfo = shell_exec($cmd);
$xml = simplexml_load_string($xmlInfo);
$entry = $xml->entry;
$file = array();
$file['fullpath'] = $totest;
$file['hash'] = (string) $entry->repository->uuid;
$file['type'] = $this->assoc[(string) $entry['kind']];
$file['file'] = $totest;
$file['rev'] = (string) $entry->commit['revision'];
$file['author'] = (string) $entry->author;
$file['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->commit->date));
$file['size'] = (string) $entry->size;
$file['log'] = '';
return (object) $file;
}
/**
* Get a blob.
*
* @param string Blob hash
* @return string Raw blob
*/
public function getBlob($path, $rev)
{
$cmd = sprintf('svn cat --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
return shell_exec($cmd);
}
/**
* Get the branches.
*
* @return array Branches.
*/
public function getBranches()
{
$res = array('HEAD');
return $res;
}
/**
* Get commit details.
*
* @param string Commit ('HEAD').
* @return array Changes.
*/
public function getCommit($rev='HEAD')
{
$res = array();
$cmd = sprintf('svn log --xml -v --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlRes = shell_exec($cmd);
$xml = simplexml_load_string($xmlRes);
$res['author'] = (string) $xml->logentry->author;
$res['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $xml->logentry->date));
$res['title'] = (string) $xml->logentry->msg;
$res['commit'] = (string) $xml->logentry['revision'];
$res['changes'] = $this->getDiff($rev);
$res['tree'] = '';
return (object) $res;
}
private function getDiff($rev='HEAD')
{
$res = array();
$cmd = sprintf('svn diff -c %s --username=%s --password=%s %s',
escapeshellarg($rev),
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo));
return shell_exec($cmd);
}
/**
* Get latest changes.
*
* @param string Commit ('HEAD').
* @param int Number of changes (10).
*
* @return array Changes.
*/
public function getChangeLog($rev='HEAD', $n=10)
{
$res = array();
$cmd = sprintf('svn log --xml -v --limit %s --username=%s --password=%s %s@%s',
escapeshellarg($n),
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlRes = shell_exec($cmd);
$xml = simplexml_load_string($xmlRes);
$res = array();
foreach ($xml->logentry as $entry) {
$log = array();
$log['author'] = (string) $entry->author;
$log['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->date));
$log['title'] = (string) $entry->msg;
$log['commit'] = (string) $entry['revision'];
$log['full_message'] = '';
$res[] = (object) $log;
}
return $res;
}
/**
* Generate the command to create a zip archive at a given commit.
* Unsupported feature in subversion
*
* @param string dummy
* @param string dummy
* @return Exception
*/
public function getArchiveCommand($commit, $prefix='git-repo-dump/')
{
throw new Exception(('Unsupported feature.'));
}
/**
* Get additionnals properties on path and revision
*
* @param string File
* @param string Commit ('HEAD')
* @return array
*/
public function getProperties($rev, $path='')
{
$res = array();
$cmd = sprintf('svn proplist --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlProps = shell_exec($cmd);
$props = simplexml_load_string($xmlProps);
// No properties, returns an empty array
if (!isset($props->target)) {
return $res;
}
// Get the value of each property
foreach ($props->target->property as $prop) {
$key = (string) $prop['name'];
$res[$key] = $this->getProperty($key, $rev, $path);
}
return $res;
}
/**
* Get a specific additionnal property on path and revision
*
* @param string Property
* @param string File
* @param string Commit ('HEAD')
* @return string the property value
*/
private function getProperty($property, $rev, $path='')
{
$res = array();
$cmd = sprintf('svn propget --xml %s --username=%s --password=%s %s@%s',
escapeshellarg($property),
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlProp = shell_exec($cmd);
$prop = simplexml_load_string($xmlProp);
return (string) $prop->target->property;
}
/**
* Get the number of the last commit in the repository.
*
* @param string Commit ('HEAD').
*
* @return String last number commit
*/
public function getLastCommit($rev='HEAD')
{
$xmlInfo = '';
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlInfo = shell_exec($cmd);
$xml = simplexml_load_string($xmlInfo);
return (string) $xml->entry->commit['revision'];
}
}
src/IDF/ScmFactory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008 CĂ©ondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* Manage differents SCM systems
*/
class IDF_ScmFactory
{
/**
* Returns an instance of the correct scm backend object.
*
* @return Object
*/
public static function getScm($request=null)
{
// Get scm type from project conf ; defaults to git
switch ($request->conf->getVal('scm', 'git')) {
case 'svn':
return new IDF_Svn($request->conf->getVal('svn_repository'),
$request->conf->getVal('svn_username'),
$request->conf->getVal('svn_password'));
case 'git':
default:
return new IDF_Git($request->project->getGitRepository());
}
}
}
src/IDF/Svn.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008 CĂ©ondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* SVN utils.
*
*/
class IDF_Svn
{
public $repo = '';
public $username = '';
public $password = '';
private $assoc = array('dir' => 'tree',
'file' => 'blob');
public function __construct($repo, $username='', $password='')
{
$this->repo = $repo;
$this->username = $username;
$this->password = $password;
}
/**
* Test a given object hash.
*
* @param string Object hash.
* @return mixed false if not valid or 'blob', 'tree', 'commit'
*/
public function testHash($rev, $path='')
{
// OK if HEAD on /
if ($rev === 'HEAD' && $path === '') {
return 'commit';
}
// Else, test the path on revision
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlInfo = shell_exec($cmd);
// If exception is thrown, return false
try {
$xml = simplexml_load_string($xmlInfo);
}
catch (Exception $e) {
return false;
}
// If the entry node does exists, params are wrong
if (!isset($xml->entry)) {
return false;
}
// Else, enjoy it :)
return 'commit';
}
/**
* Given a commit hash returns an array of files in it.
*
* A file is a class with the following properties:
*
* 'perm', 'type', 'size', 'hash', 'file'
*
* @param string Commit ('HEAD')
* @param string Base folder ('')
* @return array
*/
public function filesAtCommit($rev='HEAD', $folder='')
{
$cmd = sprintf('svn ls --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$folder),
escapeshellarg($rev));
$xmlLs = shell_exec($cmd);
$xml = simplexml_load_string($xmlLs);
$res = array();
foreach ($xml->list->entry as $entry) {
$file = array();
$file['type'] = $this->assoc[(string) $entry['kind']];
$file['file'] = (string) $entry->name;
$file['fullpath'] = $folder.'/'.((string) $entry->name);
$file['date'] = gmdate('Y-m-d H:i:s',
strtotime((string) $entry->commit->date));
$file['rev'] = (string) $entry->commit['revision'];
// Get commit message
$currentReposFile = $this->repo.'/'.$folder.'/'.$file['file'];
$file['log'] = $this->getCommitMessage($currentReposFile, $rev);
// Get the size if the type is blob
if ($file['type'] == 'blob') {
$file['size'] = (string) $entry->size;
}
$file['perm'] = '';
$res[] = (object) $file;
}
return $res;
}
/**
* Get a commit message for given file and revision.
*
* @param string File
* @param string Commit ('HEAD')
*
* @return String commit message
*/
private function getCommitMessage($file, $rev='HEAD')
{
$cmd = sprintf('svn log --xml --limit 1 --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($file),
escapeshellarg($rev));
$xmlLog = shell_exec($cmd);
$xml = simplexml_load_string($xmlLog);
return (string) $xml->logentry->msg;
}
/**
* Get the file info.
*
* @param string File
* @param string Commit ('HEAD')
* @return false Information
*/
public function getFileInfo($totest, $rev='HEAD')
{
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$totest),
escapeshellarg($rev));
$xmlInfo = shell_exec($cmd);
$xml = simplexml_load_string($xmlInfo);
$entry = $xml->entry;
$file = array();
$file['fullpath'] = $totest;
$file['hash'] = (string) $entry->repository->uuid;
$file['type'] = $this->assoc[(string) $entry['kind']];
$file['file'] = $totest;
$file['rev'] = (string) $entry->commit['revision'];
$file['author'] = (string) $entry->author;
$file['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->commit->date));
$file['size'] = (string) $entry->size;
$file['log'] = '';
return (object) $file;
}
/**
* Get a blob.
*
* @param string Blob hash
* @return string Raw blob
*/
public function getBlob($path, $rev)
{
$cmd = sprintf('svn cat --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
return shell_exec($cmd);
}
/**
* Get the branches.
*
* @return array Branches.
*/
public function getBranches()
{
$res = array('HEAD');
return $res;
}
/**
* Get commit details.
*
* @param string Commit ('HEAD').
* @return array Changes.
*/
public function getCommit($rev='HEAD')
{
$res = array();
$cmd = sprintf('svn log --xml -v --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlRes = shell_exec($cmd);
$xml = simplexml_load_string($xmlRes);
$res['author'] = (string) $xml->logentry->author;
$res['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $xml->logentry->date));
$res['title'] = (string) $xml->logentry->msg;
$res['commit'] = (string) $xml->logentry['revision'];
$res['changes'] = $this->getDiff($rev);
$res['tree'] = '';
return (object) $res;
}
private function getDiff($rev='HEAD')
{
$res = array();
$cmd = sprintf('svn diff -c %s --username=%s --password=%s %s',
escapeshellarg($rev),
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo));
return shell_exec($cmd);
}
/**
* Get latest changes.
*
* @param string Commit ('HEAD').
* @param int Number of changes (10).
*
* @return array Changes.
*/
public function getChangeLog($rev='HEAD', $n=10)
{
$res = array();
$cmd = sprintf('svn log --xml -v --limit %s --username=%s --password=%s %s@%s',
escapeshellarg($n),
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlRes = shell_exec($cmd);
$xml = simplexml_load_string($xmlRes);
$res = array();
foreach ($xml->logentry as $entry) {
$log = array();
$log['author'] = (string) $entry->author;
$log['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->date));
$log['title'] = (string) $entry->msg;
$log['commit'] = (string) $entry['revision'];
$log['full_message'] = '';
$res[] = (object) $log;
}
return $res;
}
/**
* Generate the command to create a zip archive at a given commit.
* Unsupported feature in subversion
*
* @param string dummy
* @param string dummy
* @return Exception
*/
public function getArchiveCommand($commit, $prefix='git-repo-dump/')
{
throw new Exception(('Unsupported feature.'));
}
/**
* Get additionnals properties on path and revision
*
* @param string File
* @param string Commit ('HEAD')
* @return array
*/
public function getProperties($rev, $path='')
{
$res = array();
$cmd = sprintf('svn proplist --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlProps = shell_exec($cmd);
$props = simplexml_load_string($xmlProps);
// No properties, returns an empty array
if (!isset($props->target)) {
return $res;
}
// Get the value of each property
foreach ($props->target->property as $prop) {
$key = (string) $prop['name'];
$res[$key] = $this->getProperty($key, $rev, $path);
}
return $res;
}
/**
* Get a specific additionnal property on path and revision
*
* @param string Property
* @param string File
* @param string Commit ('HEAD')
* @return string the property value
*/
private function getProperty($property, $rev, $path='')
{
$res = array();
$cmd = sprintf('svn propget --xml %s --username=%s --password=%s %s@%s',
escapeshellarg($property),
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlProp = shell_exec($cmd);
$prop = simplexml_load_string($xmlProp);
return (string) $prop->target->property;
}
/**
* Get the number of the last commit in the repository.
*
* @param string Commit ('HEAD').
*
* @return String last number commit
*/
public function getLastCommit($rev='HEAD')
{
$xmlInfo = '';
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlInfo = shell_exec($cmd);
$xml = simplexml_load_string($xmlInfo);
return (string) $xml->entry->commit['revision'];
}
}
src/IDF/Template/IssueComment.php
3030
3131
3232
33
33
3434
3535
3636
3737
3838
39
39
4040
4141
4242
......
4747
4848
4949
50
50
5151
5252
5353
......
9090
9191
9292
93
93
9494
9595
96
96
9797
9898
9999
{
private $project = null;
private $request = null;
private $git = null;
private $scm = null;
function start($text, $request)
{
$this->project = $request->project;
$this->request = $request;
$this->git = new IDF_Git($this->project->getGitRepository());
$this->scm = IDF_Scm::get($request);
$text = wordwrap($text, 69, "\n", true);
$text = Pluf_esc($text);
$text = ereg_replace('[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]',
array($this, 'callbackIssues'), $text);
}
if ($request->rights['hasSourceAccess']) {
$text = preg_replace_callback('#(commit\s+)([0-9a-f]{5,40})#im',
$text = preg_replace_callback('#(commit\s+)([0-9a-f]{1,40})#im',
array($this, 'callbackCommit'), $text);
}
echo $text;
function callbackCommit($m)
{
if ($this->git->testHash($m[2]) != 'commit') {
if ($this->scm->testHash($m[2]) != 'commit') {
return $m[0];
}
$co = $this->git->getCommit($m[2]);
$co = $this->scm->getCommit($m[2]);
return '<a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit', array($this->project->shortname, $co->commit)).'">'.$m[1].$m[2].'</a>';
}
src/IDF/Views/Source.php
3636
3737
3838
39
39
4040
4141
4242
......
5858
5959
6060
61
61
6262
6363
6464
......
9696
9797
9898
99
99
100100
101101
102102
......
179179
180180
181181
182
182
183183
184184
185185
......
216216
217217
218218
219
219
220220
221221
222222
{
$title = sprintf(__('%s %s Change Log'), (string) $request->project,
$this->getScmType($request));
$scm = IDF_ScmFactory::getScm($request);
$scm = IDF_Scm::get($request);
$branches = $scm->getBranches();
$commit = $match[2];
$res = $scm->getChangeLog($commit, 25);
{
$title = sprintf(__('%s %s Source Tree'), (string) $request->project,
$this->getScmType($request));
$scm = IDF_ScmFactory::getScm($request);
$scm = IDF_Scm::get($request);
$commit = $match[2];
$branches = $scm->getBranches();
if ('commit' != $scm->testHash($commit)) {
{
$title = sprintf(__('%s %s Source Tree'), (string) $request->project,
$this->getScmType($request));
$scm = IDF_ScmFactory::getScm($request);
$scm = IDF_Scm::get($request);
$branches = $scm->getBranches();
$commit = $match[2];
$request_file = $match[3];
public $commit_precond = array('IDF_Precondition::accessSource');
public function commit($request, $match)
{
$scm = IDF_ScmFactory::getScm($request);
$scm = IDF_Scm::get($request);
$commit = $match[2];
$branches = $scm->getBranches();
if ('commit' != $scm->testHash($commit)) {
public function download($request, $match)
{
$commit = trim($match[2]);
$scm = IDF_ScmFactory::getScm($request);
$scm = IDF_Scm::get($request);
$branches = $scm->getBranches();
if ('commit' != $scm->testHash($commit)) {
// Redirect to the first branch

Archive Download the corresponding diff file

Page rendered in 0.14627s using 13 queries.