diff --git a/codepot/codepot.spec.in b/codepot/codepot.spec.in index 329a0262..d6bc9c4b 100644 --- a/codepot/codepot.spec.in +++ b/codepot/codepot.spec.in @@ -35,7 +35,9 @@ Conflicts: %{php_package_name}-pecl-svn %description peclsvn This package contains svn.so for PHP. You can install this package -if your system doesn't have a proper Subversion extenstion for PHP. +if your system doesn't have a proper Subversion extenstion required by Codepot. +It is also safe to install this RPM package without Codepot by ignoring the +dependency. %prep %setup -q diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index 873a3ddd..73ce13ad 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -101,7 +101,6 @@ class Code extends Controller $data['file'] = $file; $data['revision'] = $rev; - $this->load->view ($this->VIEW_FILE, $data); } } diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 874c4bd1..266b1f38 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -46,13 +46,14 @@ class SubversionModel extends Model if ($info === FALSE || count($info) != 1) return FALSE; } - if ($info[0]['kind'] == SVN_NODE_FILE) + $info0 = &$info[0]; + if ($info0['kind'] == SVN_NODE_FILE) { $lsinfo = @svn_ls ($workurl, $rev, FALSE, TRUE); if ($lsinfo === FALSE) return FALSE; - if (array_key_exists ($info[0]['path'], $lsinfo) === FALSE) return FALSE; - $fileinfo = $lsinfo[$info[0]['path']]; + if (array_key_exists ($info0['path'], $lsinfo) === FALSE) return FALSE; + $fileinfo = $lsinfo[$info0['path']]; $str = @svn_cat ($workurl, $rev); if ($str === FALSE) return FALSE; @@ -73,23 +74,28 @@ class SubversionModel extends Model else $fileinfo['properties'] = NULL; $fileinfo['fullpath'] = substr ( - $info[0]['url'], strlen($info[0]['repos'])); + $info0['url'], strlen($info0['repos'])); $fileinfo['content'] = $str; $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; return $fileinfo; } - else if ($info[0]['kind'] == SVN_NODE_DIR) + else if ($info0['kind'] == SVN_NODE_DIR) { $list = @svn_ls ($workurl, $rev, FALSE, TRUE); if ($list === FALSE) return FALSE; - if ($info[0]['revision'] <= 0) $log = array(); + $rev_key = 'last_changed_rev'; + if (array_key_exists($rev_key, $info0) === FALSE) $rev_key = 'revision'; + + if (array_key_exists($rev_key, $info0) === FALSE || $info0[$rev_key] <= 0) + { + $log = array(); + } else { $log = @svn_log ($workurl, - $info[0]['revision'], - $info[0]['revision'], + $info0[$rev_key], $info0[$rev_key], 1, SVN_DISCOVER_CHANGED_PATHS); if ($log === FALSE) return FALSE; } @@ -101,15 +107,15 @@ class SubversionModel extends Model $fileinfo['properties'] = $prop[$orgurl]; else $fileinfo['properties'] = NULL; - $fileinfo['fullpath'] = substr ($info[0]['url'], strlen($info[0]['repos'])); - $fileinfo['name'] = $info[0]['path']; + $fileinfo['fullpath'] = substr ($info0['url'], strlen($info0['repos'])); + $fileinfo['name'] = $info0['path']; $fileinfo['type'] = 'dir'; $fileinfo['size'] = 0; - $fileinfo['created_rev'] = $info[0]['revision']; - if (array_key_exists ('last_changed_author', $info[0]) === FALSE) + $fileinfo['created_rev'] = $info0[$rev_key]; + if (array_key_exists ('last_changed_author', $info0) === FALSE) $fileinfo['last_author'] = ''; else - $fileinfo['last_author'] = $info[0]['last_changed_author']; + $fileinfo['last_author'] = $info0['last_changed_author']; $fileinfo['content'] = $list; $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; return $fileinfo; @@ -133,13 +139,14 @@ class SubversionModel extends Model if ($info === FALSE || count($info) != 1) return FALSE; } - if ($info[0]['kind'] != SVN_NODE_FILE) return FALSE; + $info0 = $info[0]; + if ($info0['kind'] != SVN_NODE_FILE) return FALSE; $lsinfo = @svn_ls ($workurl, $rev, FALSE, TRUE); if ($lsinfo === FALSE) return FALSE; - if (array_key_exists ($info[0]['path'], $lsinfo) === FALSE) return FALSE; - $fileinfo = $lsinfo[$info[0]['path']]; + if (array_key_exists ($info0['path'], $lsinfo) === FALSE) return FALSE; + $fileinfo = $lsinfo[$info0['path']]; $str = @svn_blame ($workurl, $rev); if ($str === FALSE) return FALSE; @@ -151,7 +158,7 @@ class SubversionModel extends Model if ($log === FALSE) return FALSE; $fileinfo['fullpath'] = substr ( - $info[0]['url'], strlen($info[0]['repos'])); + $info0['url'], strlen($info0['repos'])); $fileinfo['content'] = $str; $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; return $fileinfo; diff --git a/codepot/src/codepot/views/code_folder.php b/codepot/src/codepot/views/code_folder.php index 1ef3a242..4aaa6fe5 100644 --- a/codepot/src/codepot/views/code_folder.php +++ b/codepot/src/codepot/views/code_folder.php @@ -280,7 +280,6 @@ $this->load->view ( ?> -