Indefero

Indefero Commit Details


Date:2009-04-26 04:57:21 (15 years 7 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
Commit:cf5acfb6693bb632545be6e644ab66d874dea3e0
Parents: 7c502b1745a2f7188299dac7c754f21690c6e858
Message:Base refactor of the Subversion backend.

Changes:

File differences

src/IDF/Scm/Svn.php
2525
2626
2727
28
28
2929
3030
3131
......
4242
4343
4444
45
46
47
48
49
4550
4651
4752
......
6267
6368
6469
65
70
6671
6772
6873
......
96101
97102
98103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
99122
100123
101124
......
114137
115138
116139
117
140
118141
119142
120143
......
133156
134157
135158
136
137
138
139
140
141
142
143
144
145
146
147
148
159
149160
150161
151162
152163
153164
154165
155
166
156167
157168
158169
......
176187
177188
178189
179
180190
181191
182192
......
197207
198208
199209
200
210
201211
202212
203213
204214
205215
206
207216
208
209
210
211
212
217
213218
214
219
215220
216221
217222
218223
219224
220225
221
226
222227
223228
224
225229
226230
227231
......
236240
237241
238242
239
240
241
242
243
244
245
246
243
247244
248245
249246
250247
251
252
253
248
249
250
254251
255252
256
257253
258
254
259255
260
256
261257
262258
263259
264
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
265286
266287
267288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
268304
269305
270306
......
281317
282318
283319
284
320
285321
286322
287323
......
309345
310346
311347
312
348
313349
314350
315351
......
322358
323359
324360
325
361
326362
327363
328364
......
343379
344380
345381
346
382
347383
348384
349385
......
363399
364400
365401
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380402
381403
382404
......
391413
392414
393415
394
416
395417
396418
397419
......
426448
427449
428450
429
451
430452
431453
432454
......
448470
449471
450472
451
473
452474
453475
454476
* SVN utils.
*
*/
class IDF_Scm_Svn
class IDF_Scm_Svn extends IDF_Scm
{
public $repo = '';
public $username = '';
$this->password = $password;
}
public function isAvailable()
{
return true;
}
/**
* Given the string describing the author from the log find the
* author in the database.
* @param IDF_Project
* @return string URL
*/
public static function getRemoteAccessUrl($project)
public static function getAnonymousAccessUrl($project)
{
$conf = $project->getConf();
if (false !== ($url=$conf->getVal('svn_remote_url', false))
}
/**
* Subversion revisions are either a number or 'HEAD'.
*/
public function isValidRevision($rev)
{
if ($rev == 'HEAD') {
return true;
}
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
exec($cmd, $out, $ret);
return (0 == $ret);
}
/**
* Test a given object hash.
*
* @param string Object hash.
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlInfo = IDF_Scm::shell_exec($cmd);
$xmlInfo = shell_exec($cmd);
// If exception is thrown, return false
try {
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='')
public function getTree($rev='HEAD', $folder='')
{
$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),
escapeshellarg($rev));
$xmlLs = IDF_Scm::shell_exec($cmd);
$xmlLs = shell_exec($cmd);
$xml = simplexml_load_string($xmlLs);
$res = array();
$folder = (strlen($folder)) ? $folder.'/' : '';
$file['perm'] = '';
$res[] = (object) $file;
}
return $res;
}
escapeshellarg($this->password),
escapeshellarg($file),
escapeshellarg($rev));
$xmlLog = IDF_Scm::shell_exec($cmd);
$xmlLog = shell_exec($cmd);
$xml = simplexml_load_string($xmlLog);
$commit[$rev]=(string) $xml->logentry->msg;
return (string) $xml->logentry->msg;
}
/**
* Get the file info.
*
* @param string File
* @param string Commit ('HEAD')
* @return false Information
* FIXME: Need to check the case of an inexisting file.
*/
public function getFileInfo($totest, $rev='HEAD')
public function getPathInfo($totest, $rev='HEAD')
{
$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),
escapeshellarg($rev));
$xmlInfo = IDF_Scm::shell_exec($cmd);
$xmlInfo = shell_exec($cmd);
$xml = simplexml_load_string($xmlInfo);
$entry = $xml->entry;
$file = array();
$file['fullpath'] = $totest;
$file['hash'] = (string) $entry->repository->uuid;
return (object) $file;
}
/**
* Get a blob.
*
* @param string request_file_info
* @return string Raw blob
*/
public function getBlob($request_file_info, $rev)
public function getFile($def)
{
$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),
escapeshellarg($rev));
return IDF_Scm::shell_exec($cmd);
escapeshellarg($this->repo.'/'.$def->fullpath),
escapeshellarg($def->rev));
return shell_exec($cmd);
}
/**
* Get the branches.
* Subversion branches are repository based.
*
* @return array Branches.
* One need to list the folder to know them.
*/
public function getBranches()
{
$res = array('HEAD');
if (isset($this->cache['branches'])) {
return $this->cache['branches'];
}
$cmd = sprintf(Pluf::f('svn_path', 'svn').' ls --username=%s --password=%s %s@HEAD',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/branches'));
exec($cmd, $out, $ret);
if ($ret == 0) {
foreach ($out as $entry) {
if (substr(trim($entry), -1) == '/') {
$branch = substr(trim($entry), 0, -1);
$res[$branch] = 'branches/'.$branch;
}
}
}
ksort($res);
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --username=%s --password=%s %s@HEAD',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/trunk'));
exec($cmd, $out, $ret);
if ($ret == 0) {
$res = array_merge(array('trunk' => 'trunk'), $res);
}
$this->cache['branches'] = $res;
return $res;
}
public function getMainBranch()
{
return 'HEAD';
}
public function inBranches($commit, $path)
{
foreach ($this->getBranches() as $branch => $bpath) {
if ($bpath and 0 === strpos($path, $bpath)) {
return array($branch);
}
}
return array();
}
/**
* Get commit details.
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlRes = IDF_Scm::shell_exec($cmd);
$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));
$cmd = sprintf(Pluf::f('svnlook_path', 'svnlook').' changed -r %s %s',
escapeshellarg($commit),
escapeshellarg($repo));
$out = IDF_Scm::shell_exec($cmd);
$out = shell_exec($cmd);
$lines = preg_split("/\015\012|\015|\012/", $out);
return (count($lines) > 100);
}
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo));
return IDF_Scm::shell_exec($cmd);
return shell_exec($cmd);
}
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlRes = IDF_Scm::shell_exec($cmd);
$xmlRes = shell_exec($cmd);
$xml = simplexml_load_string($xmlRes);
$res = array();
/**
* 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
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlProps = IDF_Scm::shell_exec($cmd);
$xmlProps = shell_exec($cmd);
$props = simplexml_load_string($xmlProps);
// No properties, returns an empty array
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev));
$xmlProp = IDF_Scm::shell_exec($cmd);
$xmlProp = shell_exec($cmd);
$prop = simplexml_load_string($xmlProp);
return (string) $prop->target->property;
escapeshellarg($this->password),
escapeshellarg($this->repo),
escapeshellarg($rev));
$xmlInfo = IDF_Scm::shell_exec($cmd);
$xmlInfo = shell_exec($cmd);
$xml = simplexml_load_string($xmlInfo);
return (string) $xml->entry->commit['revision'];
src/IDF/Views/Source.php
219219
220220
221221
222
223222
224223
225224
} catch (Exception $e) {
throw $e;
// return new Pluf_HTTP_Response_Redirect($fburl);
}
// try to find the previous level if it exists.
$prev = split('/', $request_file);
src/IDF/templates/idf/source/svn/tree.html
6868
6969
7070
71
72
73
74
75
76
77
7178
7279
<input type="hidden" name="sourcefile" value="{$base}"/>
<input type="submit" name="s" value="{trans 'Go to revision'}" /></p>
</form>
<p><strong>{trans 'Branches:'}</strong><br />
{foreach $branches as $branch => $path}
{if $path}{aurl 'url', 'IDF_Views_Source::tree', array($project.shortname, 'HEAD', $path)}
{else}{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, 'HEAD')}{/if}
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{$branch}</a></span><br />
{/foreach}
</p>
{/block}

Archive Download the corresponding diff file

Page rendered in 0.09279s using 13 queries.