Added the latest fixes for the new backend.

This commit is contained in:
Loic d'Anterroches
2009-05-25 14:18:48 +02:00
parent c83e2e6f30
commit d31cd2aef4
6 changed files with 53 additions and 54 deletions

View File

@@ -207,17 +207,6 @@ class IDF_Scm_Mercurial extends IDF_Scm
} else {
$type = 'blob';
}
if (!$root and !$folder and preg_match('/^.*\/.*$/', $file)) {
continue;
}
if ($folder) {
preg_match('|^'.$folder.'[/]?([^/]+)?$|', $file,$match);
if (count($match) > 1) {
$file = $match[1];
} else {
continue;
}
}
if ($totest == $file) {
return (object) array('perm' => $perm, 'type' => $type,
'hash' => $hash,
@@ -229,19 +218,13 @@ class IDF_Scm_Mercurial extends IDF_Scm
return false;
}
/**
* Get a blob.
*
* @param string request_file_info
* @param null to be svn client compatible
* @return string Raw blob
*/
public function getBlob($request_file_info, $dummy=null)
public function getFile($def, $cmd_only=false)
{
return 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)));
$cmd = sprintf(Pluf::f('hg_path', 'hg').' cat -R %s -r %s %s',
escapeshellarg($this->repo),
escapeshellarg($def->commit),
escapeshellarg($this->repo.'/'.$def->file));
return ($cmd_only) ? $cmd : shell_exec($cmd);
}
/**