Fixed issue 199, some optimizations for SVN access.

This commit is contained in:
Patrick Georgi 2009-04-20 15:05:34 +02:00 committed by Loic d'Anterroches
parent 2b8743727a
commit 0efb0fec44

View File

@ -33,6 +33,7 @@ class IDF_Scm_Svn
private $assoc = array('dir' => 'tree', private $assoc = array('dir' => 'tree',
'file' => 'blob'); 'file' => 'blob');
private $commit=array();
public function __construct($repo, $username='', $password='') public function __construct($repo, $username='', $password='')
{ {
@ -190,6 +191,7 @@ class IDF_Scm_Svn
*/ */
private function getCommitMessage($file, $rev='HEAD') private function getCommitMessage($file, $rev='HEAD')
{ {
if (isset($commit[$rev])) return $commit[$rev];
$cmd = sprintf(Pluf::f('svn_path', '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->username),
escapeshellarg($this->password), escapeshellarg($this->password),
@ -197,6 +199,7 @@ class IDF_Scm_Svn
escapeshellarg($rev)); escapeshellarg($rev));
$xmlLog = IDF_Scm::shell_exec($cmd); $xmlLog = IDF_Scm::shell_exec($cmd);
$xml = simplexml_load_string($xmlLog); $xml = simplexml_load_string($xmlLog);
$commit[$rev]=(string) $xml->logentry->msg;
return (string) $xml->logentry->msg; return (string) $xml->logentry->msg;
} }
@ -273,7 +276,7 @@ class IDF_Scm_Svn
public function getCommit($rev='HEAD', $getdiff=false) public function getCommit($rev='HEAD', $getdiff=false)
{ {
$res = array(); $res = array();
$cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml -v --username=%s --password=%s %s@%s', $cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml --limit 1 -v --username=%s --password=%s %s@%s',
escapeshellarg($this->username), escapeshellarg($this->username),
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo), escapeshellarg($this->repo),