Indefero

Indefero Commit Details


Date:2009-02-25 07:28:14 (15 years 9 months ago)
Author:Manuel Eidenberger
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
Commit:42c6f53fbc38b1e4849d49c9bf0260222ac6e6bf
Parents: 64dc8ec3b8510f4408f3fddb7a038cadeae9172f
Message:Added the ability to configure the paths to the SCM executables.

Changes:

File differences

src/IDF/Plugin/SyncGit/Serve.php
192192
193193
194194
195
195
196196
197197
198198
{
mkdir($fullpath, 0750, true);
exec(sprintf(Pluf::f('idf_exec_cmd_prefix', '').
'git --git-dir=%s init', escapeshellarg($fullpath)),
Pluf::f('git_path', 'git').' --git-dir=%s init', escapeshellarg($fullpath)),
$out, $res);
if ($res != 0) {
throw new Exception(sprintf('Init repository error, exit status %d.', $res));
src/IDF/Plugin/SyncMercurial.php
7777
7878
7979
80
80
8181
8282
8383
}
$return = 0;
$output = array();
$cmd = sprintf('hg init %s',
$cmd = sprintf(Pluf::f('hg_path', 'hg').' init %s',
escapeshellarg($mercurial_path.'/'.$shortname));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$ll = exec($cmd, $output, $return);
src/IDF/Plugin/SyncSvn.php
7777
7878
7979
80
80
8181
8282
8383
}
$return = 0;
$output = array();
$cmd = sprintf('svnadmin create %s',
$cmd = sprintf(Pluf::f('svnadmin_path', 'svnadmin').' create %s',
escapeshellarg($svn_path.'/'.$shortname));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$ll = exec($cmd, $output, $return);
src/IDF/Scm/Git.php
9898
9999
100100
101
101
102102
103103
104104
......
143143
144144
145145
146
146
147147
148148
149149
......
182182
183183
184184
185
185
186186
187187
188188
......
209209
210210
211211
212
212
213213
214214
215215
......
236236
237237
238238
239
239
240240
241241
242242
......
249249
250250
251251
252
252
253253
254254
255255
......
268268
269269
270270
271
271
272272
273273
274274
275275
276
276
277277
278278
279279
......
306306
307307
308308
309
309
310310
311311
312312
......
339339
340340
341341
342
342
343343
344344
345345
......
412412
413413
414414
415
415
416416
417417
418418
*/
public function testHash($hash, $dummy=null)
{
$cmd = sprintf('GIT_DIR=%s git cat-file -t %s',
$cmd = sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' cat-file -t %s',
escapeshellarg($this->repo),
escapeshellarg($hash));
$ret = 0; $out = 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 -5000 %s',
$cmd = sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' log --raw --abbrev=40 --pretty=oneline -5000 %s',
escapeshellarg($this->repo), escapeshellarg($commit));
IDF_Scm::exec($cmd, $rawlog);
// We reverse the log to be able to use a fixed efficient
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 %s';
$cmd_tmpl = 'GIT_DIR=%s '.Pluf::f('git_path', 'git').' ls-tree%s -t -l %s %s';
$cmd = sprintf($cmd_tmpl,
escapeshellarg($this->repo),
($recurse) ? ' -r' : '',
*/
public function getFileInfo($totest, $commit='HEAD')
{
$cmd_tmpl = 'GIT_DIR=%s git ls-tree -r -t -l %s';
$cmd_tmpl = 'GIT_DIR=%s '.Pluf::f('git_path', 'git').' ls-tree -r -t -l %s';
$cmd = sprintf($cmd_tmpl,
escapeshellarg($this->repo),
escapeshellarg($commit));
public function getBlob($request_file_info, $dummy=null)
{
return shell_exec(sprintf(Pluf::f('idf_exec_cmd_prefix', '').
'GIT_DIR=%s git cat-file blob %s',
'GIT_DIR=%s '.Pluf::f('git_path', 'git').' cat-file blob %s',
escapeshellarg($this->repo),
escapeshellarg($request_file_info->hash)));
}
public function getBranches()
{
$out = array();
IDF_Scm::exec(sprintf('GIT_DIR=%s git branch',
IDF_Scm::exec(sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' branch',
escapeshellarg($this->repo)), $out);
$res = array();
foreach ($out as $b) {
public function getCommit($commit='HEAD', $getdiff=false)
{
if ($getdiff) {
$cmd = sprintf('GIT_DIR=%s git show --date=iso --pretty=format:%s %s',
$cmd = sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' show --date=iso --pretty=format:%s %s',
escapeshellarg($this->repo),
"'".$this->mediumtree_fmt."'",
escapeshellarg($commit));
} else {
$cmd = sprintf('GIT_DIR=%s git log -1 --date=iso --pretty=format:%s %s',
$cmd = sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' log -1 --date=iso --pretty=format:%s %s',
escapeshellarg($this->repo),
"'".$this->mediumtree_fmt."'",
escapeshellarg($commit));
*/
public function isCommitLarge($commit='HEAD')
{
$cmd = sprintf('GIT_DIR=%s git log --numstat -1 --pretty=format:%s %s',
$cmd = sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' log --numstat -1 --pretty=format:%s %s',
escapeshellarg($this->repo),
"'commit %H%n'",
escapeshellarg($commit));
{
if ($n === null) $n = '';
else $n = ' -'.$n;
$cmd = sprintf('GIT_DIR=%s git log%s --date=iso --pretty=format:\'%s\' %s',
$cmd = sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' log%s --date=iso --pretty=format:\'%s\' %s',
escapeshellarg($this->repo), $n, $this->mediumtree_fmt,
escapeshellarg($commit));
$out = array();
public function getArchiveCommand($commit, $prefix='git-repo-dump/')
{
return sprintf(Pluf::f('idf_exec_cmd_prefix', '').
'GIT_DIR=%s git archive --format=zip --prefix=%s %s',
'GIT_DIR=%s '.Pluf::f('git_path', 'git').' archive --format=zip --prefix=%s %s',
escapeshellarg($this->repo),
escapeshellarg($prefix),
escapeshellarg($commit));
src/IDF/Scm/Mercurial.php
8585
8686
8787
88
88
8989
9090
9191
......
139139
140140
141141
142
142
143143
144144
145145
......
195195
196196
197197
198
198
199199
200200
201201
......
248248
249249
250250
251
251
252252
253253
254254
......
262262
263263
264264
265
265
266266
267267
268268
......
282282
283283
284284
285
285
286286
287287
288288
......
325325
326326
327327
328
328
329329
330330
331331
......
399399
400400
401401
402
402
403403
404404
405405
*/
public function testHash($hash, $dummy=null)
{
$cmd = sprintf('hg log -R %s -r %s',
$cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -r %s',
escapeshellarg($this->repo),
escapeshellarg($hash));
$ret = 0;
if ('commit' != $this->testHash($tree)) {
throw new Exception(sprintf(__('Not a valid tree: %s.'), $tree));
}
$cmd_tmpl = 'hg manifest -R %s --debug -r %s';
$cmd_tmpl = Pluf::f('hg_path', 'hg').' manifest -R %s --debug -r %s';
$cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo), $tree, ($recurse) ? '' : '');
$out = array();
$res = array();
*/
public function getFileInfo($totest, $commit='tip')
{
$cmd_tmpl = 'hg manifest -R %s --debug -r %s';
$cmd_tmpl = Pluf::f('hg_path', 'hg').' manifest -R %s --debug -r %s';
$cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo), $commit);
$out = array();
$res = array();
*/
public function getBlob($request_file_info, $dummy=null)
{
return IDF_Scm::shell_exec(sprintf('hg cat -R %s -r %s %s',
return IDF_Scm::shell_exec(sprintf(Pluf::f('hg_path', 'hg').' cat -R %s -r %s %s',
escapeshellarg($this->repo),
$dummy,
escapeshellarg($this->repo . '/' . $request_file_info->file)));
public function getBranches()
{
$out = array();
IDF_Scm::exec(sprintf('hg branches -R %s',
IDF_Scm::exec(sprintf(Pluf::f('hg_path', 'hg').' branches -R %s',
escapeshellarg($this->repo)), $out);
$res = array();
foreach ($out as $b) {
public function getCommit($commit='tip', $getdiff=false)
{
$tmpl = ($getdiff) ?
'hg log -p -r %s -R %s' : 'hg log -r %s -R %s';
Pluf::f('hg_path', 'hg').' log -p -r %s -R %s' : Pluf::f('hg_path', 'hg').' log -r %s -R %s';
$cmd = sprintf($tmpl,
escapeshellarg($commit), escapeshellarg($this->repo));
$out = array();
*/
public function getChangeLog($commit='tip', $n=10)
{
$cmd = sprintf('hg log -R %s -l%s ', escapeshellarg($this->repo), $n, $commit);
$cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -l%s ', escapeshellarg($this->repo), $n, $commit);
$out = array();
IDF_Scm::exec($cmd, $out);
return self::parseLog($out, 6);
public function getArchiveCommand($commit, $prefix='')
{
return sprintf(Pluf::f('idf_exec_cmd_prefix', '').
'hg archive --type=zip -R %s -r %s -',
Pluf::f('hg_path', 'hg').' archive --type=zip -R %s -r %s -',
escapeshellarg($this->repo),
escapeshellarg($commit));
}
src/IDF/Scm/Svn.php
108108
109109
110110
111
111
112112
113113
114114
......
146146
147147
148148
149
149
150150
151151
152152
......
190190
191191
192192
193
193
194194
195195
196196
......
210210
211211
212212
213
213
214214
215215
216216
......
242242
243243
244244
245
245
246246
247247
248248
......
273273
274274
275275
276
276
277277
278278
279279
......
303303
304304
305305
306
306
307307
308308
309309
......
314314
315315
316316
317
317
318318
319319
320320
......
334334
335335
336336
337
337
338338
339339
340340
......
383383
384384
385385
386
386
387387
388388
389389
......
417417
418418
419419
420
420
421421
422422
423423
......
440440
441441
442442
443
443
444444
445445
446446
}
// Else, test the path on revision
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
*/
public function filesAtCommit($rev='HEAD', $folder='')
{
$cmd = sprintf('svn ls --xml --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' ls --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$folder),
*/
private function getCommitMessage($file, $rev='HEAD')
{
$cmd = sprintf('svn log --xml --limit 1 --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml --limit 1 --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($file),
*/
public function getFileInfo($totest, $rev='HEAD')
{
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$totest),
*/
public function getBlob($request_file_info, $rev)
{
$cmd = sprintf('svn cat --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' cat --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$request_file_info->fullpath),
public function getCommit($rev='HEAD', $getdiff=false)
{
$res = array();
$cmd = sprintf('svn log --xml -v --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml -v --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
// We have a locally hosted repository, we can query it with
// svnlook
$repo = substr($this->repo, 7);
$cmd = sprintf('svnlook changed -r %s %s',
$cmd = sprintf(Pluf::f('svnlook_path', 'svnlook').' changed -r %s %s',
escapeshellarg($commit),
escapeshellarg($repo));
$out = IDF_Scm::shell_exec($cmd);
private function getDiff($rev='HEAD')
{
$res = array();
$cmd = sprintf('svn diff -c %s --username=%s --password=%s %s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' diff -c %s --username=%s --password=%s %s',
escapeshellarg($rev),
escapeshellarg($this->username),
escapeshellarg($this->password),
public function getChangeLog($rev='HEAD', $n=10)
{
$res = array();
$cmd = sprintf('svn log --xml -v --limit %s --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml -v --limit %s --username=%s --password=%s %s@%s',
escapeshellarg($n),
escapeshellarg($this->username),
escapeshellarg($this->password),
public function getProperties($rev, $path='')
{
$res = array();
$cmd = sprintf('svn proplist --xml --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' proplist --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
private function getProperty($property, $rev, $path='')
{
$res = array();
$cmd = sprintf('svn propget --xml %s --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' propget --xml %s --username=%s --password=%s %s@%s',
escapeshellarg($property),
escapeshellarg($this->username),
escapeshellarg($this->password),
public function getLastCommit($rev='HEAD')
{
$xmlInfo = '';
$cmd = sprintf('svn info --xml --username=%s --password=%s %s@%s',
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --xml --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
src/IDF/conf/idf.php-dist
215215
216216
217217
218
219
220
221
222
223
224
225
226
227
228
229
218230
# variables not being set correctly. Note the trailing space.
# $cfg['idf_exec_cmd_prefix'] = '/usr/bin/env -i ';
# Path to the SCM binaries. These binaries are not necessarily in
# the path of your webserver or fastcgi process. In that case you
# may need to set the path manually here. This is the case with OSX.
# To know which path you need to provide, just run:
# $ which git
# from the command line. This will give you the path to git.
# $cfg['svn_path'] = 'svn';
# $cfg['svnlook_path'] = 'svnlook';
# $cfg['svnadmin_path'] = 'svnadmin';
# $cfg['hg_path'] = 'hg';
# $cfg['git_path'] = 'git';
return $cfg;

Archive Download the corresponding diff file

Page rendered in 0.10502s using 13 queries.