[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.
This commit is contained in:
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. * Get a blob.
* *
* @param string Blob hash * @param string request_file_info
* @param null to be svn client compatible
* @return string Raw blob * @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', return shell_exec(sprintf('GIT_DIR=%s git-cat-file blob %s',
escapeshellarg($this->repo), escapeshellarg($this->repo),
escapeshellarg($hash))); escapeshellarg($request_file_info->hash)));
} }
/** /**

View File

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

View File

@ -124,7 +124,7 @@ class IDF_Views_Source
} }
if ($request_file_info->type != 'tree') { if ($request_file_info->type != 'tree') {
$info = self::getMimeType($request_file_info->file); $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]); $info[0]);
$rep->headers['Content-Disposition'] = 'attachment; filename="'.$info[1].'"'; $rep->headers['Content-Disposition'] = 'attachment; filename="'.$info[1].'"';
return $rep; return $rep;