Fixed issue 245, ['idf_exec_cmd_prefix'] configuration variable is not available anymore.

This commit is contained in:
Loic d'Anterroches 2009-07-02 13:05:43 +02:00
parent cbae598893
commit 2b1a741946
3 changed files with 29 additions and 0 deletions

View File

@ -28,6 +28,7 @@
class IDF_Scm_Git extends IDF_Scm class IDF_Scm_Git extends IDF_Scm
{ {
public $mediumtree_fmt = 'commit %H%nAuthor: %an <%ae>%nTree: %T%nDate: %ai%n%n%s%n%n%b'; public $mediumtree_fmt = 'commit %H%nAuthor: %an <%ae>%nTree: %T%nDate: %ai%n%n%s%n%n%b';
public $date_fmt =
/* ============================================== * /* ============================================== *
* * * *
@ -228,6 +229,7 @@ class IDF_Scm_Git extends IDF_Scm
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($hash)); escapeshellarg($hash));
$ret = 0; $out = array(); $ret = 0; $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out, $ret); exec($cmd, $out, $ret);
if ($ret != 0) return false; if ($ret != 0) return false;
return trim($out[0]); return trim($out[0]);
@ -277,6 +279,7 @@ class IDF_Scm_Git extends IDF_Scm
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($commit)); escapeshellarg($commit));
$out = array(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out); exec($cmd, $out);
foreach ($out as $line) { foreach ($out as $line) {
list($perm, $type, $hash, $size, $file) = preg_split('/ |\t/', $line, 5, PREG_SPLIT_NO_EMPTY); list($perm, $type, $hash, $size, $file) = preg_split('/ |\t/', $line, 5, PREG_SPLIT_NO_EMPTY);
@ -322,6 +325,7 @@ class IDF_Scm_Git extends IDF_Scm
escapeshellarg($commit)); escapeshellarg($commit));
} }
$out = array(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out, $ret); exec($cmd, $out, $ret);
if ($ret != 0 or count($out) == 0) { if ($ret != 0 or count($out) == 0) {
return false; return false;
@ -357,6 +361,7 @@ class IDF_Scm_Git extends IDF_Scm
"'commit %H%n'", "'commit %H%n'",
escapeshellarg($commit)); escapeshellarg($commit));
$out = array(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out); exec($cmd, $out);
$affected = count($out) - 2; $affected = count($out) - 2;
$added = 0; $added = 0;
@ -389,6 +394,7 @@ class IDF_Scm_Git extends IDF_Scm
escapeshellarg($this->repo), $n, $this->mediumtree_fmt, escapeshellarg($this->repo), $n, $this->mediumtree_fmt,
escapeshellarg($commit)); escapeshellarg($commit));
$out = array(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out); exec($cmd, $out);
return self::parseLog($out, 4); return self::parseLog($out, 4);
} }

View File

@ -84,6 +84,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
$cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -r %s', $cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -r %s',
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($rev)); escapeshellarg($rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out, $ret); exec($cmd, $out, $ret);
return ($ret == 0); return ($ret == 0);
} }
@ -102,6 +103,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
escapeshellarg($hash)); escapeshellarg($hash));
$ret = 0; $ret = 0;
$out = array(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out, $ret); exec($cmd, $out, $ret);
return ($ret != 0) ? false : 'commit'; return ($ret != 0) ? false : 'commit';
} }
@ -145,6 +147,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
$cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo), $tree, ($recurse) ? '' : ''); $cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo), $tree, ($recurse) ? '' : '');
$out = array(); $out = array();
$res = array(); $res = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out); exec($cmd, $out);
$tmp_hack = array(); $tmp_hack = array();
while (null !== ($line = array_pop($out))) { while (null !== ($line = array_pop($out))) {
@ -191,6 +194,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
$cmd_tmpl = Pluf::f('hg_path', '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); $cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo), $commit);
$out = array(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out); exec($cmd, $out);
$tmp_hack = array(); $tmp_hack = array();
while (null !== ($line = array_pop($out))) { while (null !== ($line = array_pop($out))) {
@ -242,6 +246,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($def->commit), escapeshellarg($def->commit),
escapeshellarg($this->repo.'/'.$def->file)); escapeshellarg($this->repo.'/'.$def->file));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
return ($cmd_only) ? $cmd : shell_exec($cmd); return ($cmd_only) ? $cmd : shell_exec($cmd);
} }
@ -256,6 +261,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
return $this->cache['branches']; return $this->cache['branches'];
} }
$out = array(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec(sprintf(Pluf::f('hg_path', 'hg').' branches -R %s', exec(sprintf(Pluf::f('hg_path', 'hg').' branches -R %s',
escapeshellarg($this->repo)), $out); escapeshellarg($this->repo)), $out);
$res = array(); $res = array();
@ -287,6 +293,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
$cmd = sprintf($tmpl, $cmd = sprintf($tmpl,
escapeshellarg($commit), escapeshellarg($this->repo)); escapeshellarg($commit), escapeshellarg($this->repo));
$out = array(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out); exec($cmd, $out);
$log = array(); $log = array();
$change = array(); $change = array();
@ -328,6 +335,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
{ {
$cmd = sprintf(Pluf::f('hg_path', '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(); $out = array();
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out); exec($cmd, $out);
return self::parseLog($out, 6); return self::parseLog($out, 6);
} }

View File

@ -146,6 +146,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($rev)); escapeshellarg($rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out, $ret); exec($cmd, $out, $ret);
return (0 == $ret); return (0 == $ret);
} }
@ -170,6 +171,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path), escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev)); escapeshellarg($rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$xmlInfo = shell_exec($cmd); $xmlInfo = shell_exec($cmd);
// If exception is thrown, return false // If exception is thrown, return false
@ -196,6 +198,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$folder), escapeshellarg($this->repo.'/'.$folder),
escapeshellarg($commit)); escapeshellarg($commit));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$xml = simplexml_load_string(shell_exec($cmd)); $xml = simplexml_load_string(shell_exec($cmd));
$res = array(); $res = array();
$folder = (strlen($folder) and ($folder != '/')) ? $folder.'/' : ''; $folder = (strlen($folder) and ($folder != '/')) ? $folder.'/' : '';
@ -236,6 +239,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($rev)); escapeshellarg($rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$xml = simplexml_load_string(shell_exec($cmd)); $xml = simplexml_load_string(shell_exec($cmd));
$this->cache['commitmess'][$rev] = (string) $xml->logentry->msg; $this->cache['commitmess'][$rev] = (string) $xml->logentry->msg;
return $this->cache['commitmess'][$rev]; return $this->cache['commitmess'][$rev];
@ -251,6 +255,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$filename), escapeshellarg($this->repo.'/'.$filename),
escapeshellarg($rev)); escapeshellarg($rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$xml = simplexml_load_string(shell_exec($cmd)); $xml = simplexml_load_string(shell_exec($cmd));
if (!isset($xml->entry)) { if (!isset($xml->entry)) {
return false; return false;
@ -277,6 +282,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$def->fullpath), escapeshellarg($this->repo.'/'.$def->fullpath),
escapeshellarg($def->rev)); escapeshellarg($def->rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
return ($cmd_only) ? $cmd : shell_exec($cmd); return ($cmd_only) ? $cmd : shell_exec($cmd);
} }
@ -295,6 +301,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->username), escapeshellarg($this->username),
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/branches')); escapeshellarg($this->repo.'/branches'));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out, $ret); exec($cmd, $out, $ret);
if ($ret == 0) { if ($ret == 0) {
foreach ($out as $entry) { foreach ($out as $entry) {
@ -309,6 +316,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->username), escapeshellarg($this->username),
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/trunk')); escapeshellarg($this->repo.'/trunk'));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
exec($cmd, $out, $ret); exec($cmd, $out, $ret);
if ($ret == 0) { if ($ret == 0) {
$res = array('trunk' => 'trunk') + $res; $res = array('trunk' => 'trunk') + $res;
@ -348,6 +356,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($commit)); escapeshellarg($commit));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$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;
@ -376,6 +385,7 @@ class IDF_Scm_Svn extends IDF_Scm
$cmd = sprintf(Pluf::f('svnlook_path', 'svnlook').' changed -r %s %s', $cmd = sprintf(Pluf::f('svnlook_path', 'svnlook').' changed -r %s %s',
escapeshellarg($commit), escapeshellarg($commit),
escapeshellarg($repo)); escapeshellarg($repo));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$out = shell_exec($cmd); $out = shell_exec($cmd);
$lines = preg_split("/\015\012|\015|\012/", $out); $lines = preg_split("/\015\012|\015|\012/", $out);
return (count($lines) > 100); return (count($lines) > 100);
@ -389,6 +399,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));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
return shell_exec($cmd); return shell_exec($cmd);
} }
@ -414,6 +425,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($branch)); escapeshellarg($branch));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$xmlRes = shell_exec($cmd); $xmlRes = shell_exec($cmd);
$xml = simplexml_load_string($xmlRes); $xml = simplexml_load_string($xmlRes);
foreach ($xml->logentry as $entry) { foreach ($xml->logentry as $entry) {
@ -445,6 +457,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path), escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev)); escapeshellarg($rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$xmlProps = shell_exec($cmd); $xmlProps = shell_exec($cmd);
$props = simplexml_load_string($xmlProps); $props = simplexml_load_string($xmlProps);
@ -480,6 +493,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path), escapeshellarg($this->repo.'/'.$path),
escapeshellarg($rev)); escapeshellarg($rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$xmlProp = shell_exec($cmd); $xmlProp = shell_exec($cmd);
$prop = simplexml_load_string($xmlProp); $prop = simplexml_load_string($xmlProp);
@ -502,6 +516,7 @@ class IDF_Scm_Svn extends IDF_Scm
escapeshellarg($this->password), escapeshellarg($this->password),
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($rev)); escapeshellarg($rev));
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
$xmlInfo = shell_exec($cmd); $xmlInfo = shell_exec($cmd);
$xml = simplexml_load_string($xmlInfo); $xml = simplexml_load_string($xmlInfo);