Fixed issue 235, need consistent use of file and fullpath in the SCM backend

This commit is contained in:
Loic d'Anterroches 2009-06-19 15:51:31 +02:00
parent b320375d60
commit a15107558c
4 changed files with 12 additions and 21 deletions

View File

@ -223,21 +223,6 @@ class IDF_Scm_Git extends IDF_Scm
return trim($out[0]);
}
/**
* Given a commit hash returns an array of files in it.
*
* A file is a class with the following properties:
*
* 'perm', 'type', 'size', 'hash', 'file'
*
* @param string Commit ('HEAD')
* @param string Base folder ('')
* @return array
*/
public function filesAtCommit($commit='HEAD', $folder='')
{
}
/**
* Get the tree info.
*
@ -286,10 +271,11 @@ class IDF_Scm_Git extends IDF_Scm
foreach ($out as $line) {
list($perm, $type, $hash, $size, $file) = preg_split('/ |\t/', $line, 5, PREG_SPLIT_NO_EMPTY);
if ($totest == $file) {
$pathinfo = pathinfo($file);
return (object) array('perm' => $perm, 'type' => $type,
'size' => $size, 'hash' => $hash,
'fullpath' => $file,
'file' => $file);
'file' => $pathinfo['basename']);
}
}
return false;

View File

@ -196,9 +196,11 @@ class IDF_Scm_Mercurial extends IDF_Scm
}
$tmp .= $dir[$i];
if ($tmp == $totest) {
$pathinfo = pathinfo($totest);
return (object) array('perm' => '000', 'type' => 'tree',
'hash' => $hash,
'file' => $totest,
'fullpath' => $totest,
'file' => $pathinfo['basename'],
'commit' => $commit
);
}
@ -214,9 +216,11 @@ class IDF_Scm_Mercurial extends IDF_Scm
$type = 'blob';
}
if ($totest == $file) {
$pathinfo = pathinfo($totest);
return (object) array('perm' => $perm, 'type' => $type,
'hash' => $hash,
'file' => $file,
'fullpath' => $totest,
'file' => $pathinfo['basename'],
'commit' => $commit
);
}

View File

@ -248,7 +248,8 @@ class IDF_Scm_Svn extends IDF_Scm
$file['fullpath'] = $filename;
$file['hash'] = (string) $entry->repository->uuid;
$file['type'] = $this->assoc[(string) $entry['kind']];
$file['file'] = $filename;
$pathinfo = pathinfo($filename);
$file['file'] = $pathinfo['basename'];
$file['rev'] = $rev;
$file['author'] = (string) $entry->author;
$file['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->commit->date));

View File

@ -201,7 +201,7 @@ class IDF_Views_Source
}
}
$bc = self::makeBreadCrumb($request->project, $commit, $request_file_info->file);
$bc = self::makeBreadCrumb($request->project, $commit, $request_file_info->fullpath);
$page_title = $bc.' - '.$title;
$cobject = $scm->getCommit($commit);
@ -322,7 +322,7 @@ class IDF_Views_Source
$commit = $extra['commit'];
$request_file = $extra['request_file'];
$request_file_info = $extra['request_file_info'];
$bc = self::makeBreadCrumb($request->project, $commit, $request_file_info->file);
$bc = self::makeBreadCrumb($request->project, $commit, $request_file_info->fullpath);
$page_title = $bc.' - '.$title;
$cobject = $scm->getCommit($commit);
$in_branches = $scm->inBranches($commit, $request_file);