[PATCH] Fixed issue 41 - View Source : Missing argument 2 for IDF_Scm_Svn::getBlob()

Created an unique method declaration in the tow scm backend.
Passed a more generic argument so that the scm backend could get the
correct data.
dev
Nicolas Lassalle 2008-09-12 12:26:51 +02:00 committed by Loic d'Anterroches
parent e4f7dd8975
commit bd15328758
3 changed files with 8 additions and 7 deletions

View File

@ -203,14 +203,15 @@ class IDF_Scm_Git
/**
* Get a blob.
*
* @param string Blob hash
* @param string request_file_info
* @param null to be svn client compatible
* @return string Raw blob
*/
public function getBlob($hash)
public function getBlob($request_file_info, $dummy=null)
{
return shell_exec(sprintf('GIT_DIR=%s git-cat-file blob %s',
escapeshellarg($this->repo),
escapeshellarg($hash)));
escapeshellarg($request_file_info->hash)));
}
/**

View File

@ -228,15 +228,15 @@ class IDF_Scm_Svn
/**
* Get a blob.
*
* @param string Blob hash
* @param string request_file_info
* @return string Raw blob
*/
public function getBlob($path, $rev)
public function getBlob($request_file_info, $rev)
{
$cmd = sprintf('svn cat --username=%s --password=%s %s@%s',
escapeshellarg($this->username),
escapeshellarg($this->password),
escapeshellarg($this->repo.'/'.$path),
escapeshellarg($this->repo.'/'.$request_file_info->fullpath),
escapeshellarg($rev));
return shell_exec($cmd);
}

View File

@ -124,7 +124,7 @@ class IDF_Views_Source
}
if ($request_file_info->type != 'tree') {
$info = self::getMimeType($request_file_info->file);
$rep = new Pluf_HTTP_Response($scm->getBlob($request_file_info->hash),
$rep = new Pluf_HTTP_Response($scm->getBlob($request_file_info, $commit),
$info[0]);
$rep->headers['Content-Disposition'] = 'attachment; filename="'.$info[1].'"';
return $rep;