Fixed issue 232, repository browser on SVN shows stacktraces

This commit is contained in:
Patrick Georgi 2009-06-08 13:21:03 +02:00 committed by Loic d'Anterroches
parent d014b36ee2
commit 88a1bf9c94
2 changed files with 10 additions and 6 deletions

View File

@ -288,6 +288,7 @@ class IDF_Scm_Git extends IDF_Scm
if ($totest == $file) { if ($totest == $file) {
return (object) array('perm' => $perm, 'type' => $type, return (object) array('perm' => $perm, 'type' => $type,
'size' => $size, 'hash' => $hash, 'size' => $size, 'hash' => $hash,
'fullpath' => $file,
'file' => $file); 'file' => $file);
} }
} }

View File

@ -183,7 +183,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->username), escapeshellarg($this->username),
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$folder), escapeshellarg($this->repo.'/'.$folder),
escapeshellarg($rev)); escapeshellarg($commit));
$xml = simplexml_load_string(shell_exec($cmd)); $xml = simplexml_load_string(shell_exec($cmd));
$res = array(); $res = array();
$folder = (strlen($folder)) ? $folder.'/' : ''; $folder = (strlen($folder)) ? $folder.'/' : '';
@ -232,20 +232,23 @@ class IDF_Scm_Svn extends IDF_Scm
/** /**
* FIXME: Need to check the case of an inexisting file. * FIXME: Need to check the case of an inexisting file.
*/ */
public function getPathInfo($file, $rev=null) public function getPathInfo($filename, $rev=null)
{ {
if ($rev == null) {
$rev = 'HEAD';
}
$cmd = sprintf(Pluf::f('svn_path', '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->username),
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$file), escapeshellarg($this->repo.'/'.$filename),
escapeshellarg($rev)); escapeshellarg($rev));
$xml = simplexml_load_string(shell_exec($cmd)); $xml = simplexml_load_string(shell_exec($cmd));
$entry = $xml->entry; $entry = $xml->entry;
$file = array(); $file = array();
$file['fullpath'] = $file; $file['fullpath'] = $filename;
$file['hash'] = (string) $entry->repository->uuid; $file['hash'] = (string) $entry->repository->uuid;
$file['type'] = $this->assoc[(string) $entry['kind']]; $file['type'] = $this->assoc[(string) $entry['kind']];
$file['file'] = $file; $file['file'] = $filename;
$file['rev'] = $rev; $file['rev'] = $rev;
$file['author'] = (string) $entry->author; $file['author'] = (string) $entry->author;
$file['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->commit->date)); $file['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->commit->date));
@ -331,7 +334,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->username), escapeshellarg($this->username),
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($rev)); escapeshellarg($commit));
$xmlRes = shell_exec($cmd); $xmlRes = shell_exec($cmd);
$xml = simplexml_load_string($xmlRes); $xml = simplexml_load_string($xmlRes);
$res['author'] = (string) $xml->logentry->author; $res['author'] = (string) $xml->logentry->author;