changed the SubversionModel->getFile() to return less information on demand
This commit is contained in:
parent
fdb7d35198
commit
61f8440f57
@ -18,7 +18,7 @@ class SubversionModel extends Model
|
|||||||
return $canonical;
|
return $canonical;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFile ($projectid, $path, $rev = SVN_REVISION_HEAD, $no_file_content = FALSE)
|
function getFile ($projectid, $path, $rev = SVN_REVISION_HEAD, $type_and_name_only = FALSE)
|
||||||
{
|
{
|
||||||
//$url = 'file://'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}";
|
//$url = 'file://'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}";
|
||||||
$orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}");
|
$orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}");
|
||||||
@ -55,15 +55,16 @@ class SubversionModel extends Model
|
|||||||
if (array_key_exists ($info0['path'], $lsinfo) === FALSE) return FALSE;
|
if (array_key_exists ($info0['path'], $lsinfo) === FALSE) return FALSE;
|
||||||
$fileinfo = $lsinfo[$info0['path']];
|
$fileinfo = $lsinfo[$info0['path']];
|
||||||
|
|
||||||
if ($no_file_content)
|
if ($type_and_name_only)
|
||||||
{
|
{
|
||||||
$str = '';
|
$str = '';
|
||||||
|
$fileinfo['properties'] = NULL;
|
||||||
|
$fileinfo['logmsg'] = '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$str = @svn_cat ($workurl, $rev);
|
$str = @svn_cat ($workurl, $rev);
|
||||||
if ($str === FALSE) return FALSE;
|
if ($str === FALSE) return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
$log = @svn_log ($workurl,
|
$log = @svn_log ($workurl,
|
||||||
$fileinfo['created_rev'],
|
$fileinfo['created_rev'],
|
||||||
@ -74,15 +75,12 @@ class SubversionModel extends Model
|
|||||||
$prop = @svn_proplist ($workurl, FALSE, $rev);
|
$prop = @svn_proplist ($workurl, FALSE, $rev);
|
||||||
if ($prop === FALSE) return FALSE;
|
if ($prop === FALSE) return FALSE;
|
||||||
|
|
||||||
if (array_key_exists ($orgurl, $prop))
|
$fileinfo['properties'] = array_key_exists($orgurl, $prop)? $prop[$orgurl]: NULL;
|
||||||
{
|
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||||
$fileinfo['properties'] = $prop[$orgurl];
|
|
||||||
}
|
}
|
||||||
else $fileinfo['properties'] = NULL;
|
|
||||||
|
|
||||||
$fileinfo['fullpath'] = substr ($info0['url'], strlen($info0['repos']));
|
$fileinfo['fullpath'] = substr ($info0['url'], strlen($info0['repos']));
|
||||||
$fileinfo['content'] = $str;
|
$fileinfo['content'] = $str;
|
||||||
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
|
||||||
|
|
||||||
return $fileinfo;
|
return $fileinfo;
|
||||||
}
|
}
|
||||||
@ -93,8 +91,16 @@ class SubversionModel extends Model
|
|||||||
|
|
||||||
$rev_key = 'last_changed_rev';
|
$rev_key = 'last_changed_rev';
|
||||||
if (array_key_exists($rev_key, $info0) === FALSE) $rev_key = 'revision';
|
if (array_key_exists($rev_key, $info0) === FALSE) $rev_key = 'revision';
|
||||||
|
// assume either 'last_changed_rev' or 'revision' exists
|
||||||
|
|
||||||
if (array_key_exists($rev_key, $info0) === FALSE || $info0[$rev_key] <= 0)
|
if ($type_and_name_only)
|
||||||
|
{
|
||||||
|
$fileinfo['properties'] = NULL;
|
||||||
|
$fileinfo['logmsg'] = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($info0[$rev_key] <= 0)
|
||||||
{
|
{
|
||||||
$log = array();
|
$log = array();
|
||||||
}
|
}
|
||||||
@ -109,9 +115,9 @@ class SubversionModel extends Model
|
|||||||
$prop = @svn_proplist ($workurl, FALSE, $rev);
|
$prop = @svn_proplist ($workurl, FALSE, $rev);
|
||||||
if ($prop === FALSE) return FALSE;
|
if ($prop === FALSE) return FALSE;
|
||||||
|
|
||||||
if (array_key_exists ($orgurl, $prop))
|
$fileinfo['properties'] = array_key_exists($orgurl, $prop)? $prop[$orgurl]: NULL;
|
||||||
$fileinfo['properties'] = $prop[$orgurl];
|
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||||
else $fileinfo['properties'] = NULL;
|
}
|
||||||
|
|
||||||
$fileinfo['fullpath'] = substr ($info0['url'], strlen($info0['repos']));
|
$fileinfo['fullpath'] = substr ($info0['url'], strlen($info0['repos']));
|
||||||
$fileinfo['name'] = $info0['path'];
|
$fileinfo['name'] = $info0['path'];
|
||||||
@ -123,7 +129,6 @@ class SubversionModel extends Model
|
|||||||
else
|
else
|
||||||
$fileinfo['last_author'] = $info0['last_changed_author'];
|
$fileinfo['last_author'] = $info0['last_changed_author'];
|
||||||
$fileinfo['content'] = $list;
|
$fileinfo['content'] = $list;
|
||||||
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
|
||||||
return $fileinfo;
|
return $fileinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user