diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php
index 1e88a700..f45e48f0 100644
--- a/codepot/src/codepot/controllers/code.php
+++ b/codepot/src/codepot/controllers/code.php
@@ -915,7 +915,6 @@ class Code extends Controller
print codepot_json_encode ($result);
}
-
function history ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD)
{
$this->load->model ('ProjectModel', 'projects');
@@ -1175,8 +1174,15 @@ class Code extends Controller
$data['message'] = 'Failed to get diff';
$this->load->view ($this->VIEW_ERROR, $data);
}
+ else if (($head_rev = $this->subversion->getHeadRev ($projectid, $path, $rev1)) === FALSE)
+ {
+ $data['project'] = $project;
+ $data['message'] = 'Failed to get head revision';
+ $this->load->view ($this->VIEW_ERROR, $data);
+ }
else
{
+ $file['head_rev'] = $head_rev;
$file['prev_rev'] =
$this->subversion->getPrevRev ($projectid, $path, $file['created_rev']);
$file['next_rev'] =
diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php
index 55bfe5d1..d83fe88e 100644
--- a/codepot/src/codepot/models/subversionmodel.php
+++ b/codepot/src/codepot/models/subversionmodel.php
@@ -146,6 +146,12 @@ class SubversionModel extends Model
$fileinfo['last_author'] = '';
else
$fileinfo['last_author'] = $info0['last_changed_author'];
+
+ if (array_key_exists ('last_changed_date', $info0) === FALSE)
+ $fileinfo['last_changed_date'] = '';
+ else
+ $fileinfo['last_changed_date'] = $info0['last_changed_date'];
+
$fileinfo['content'] = $list;
return $fileinfo;
}
@@ -310,7 +316,6 @@ class SubversionModel extends Model
return TRUE;
}
-
function importFiles ($projectid, $path, $committer, $commit_message, $files, $uploader)
{
$this->errmsg = '';
@@ -1090,6 +1095,16 @@ class SubversionModel extends Model
}
fclose ($diff);
+ $log = @svn_log ($info1[0]['url'], $fileinfo['created_rev'], $fileinfo['created_rev'], 1, SVN_DISCOVER_CHANGED_PATHS);
+ if ($log === FALSE) $log = @svn_log ($workurl1, $fileinfo['created_rev'], $fileinfo['created_rev'], 1, SVN_DISCOVER_CHANGED_PATHS);
+ if ($log === FALSE) $fileinfo['logmsg'] = '';
+ else $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
+
+ $log = @svn_log ($info2[0]['url'], $fileinfo['against']['created_rev'], $fileinfo['against']['created_rev'], 1, SVN_DISCOVER_CHANGED_PATHS);
+ if ($log === FALSE) $log = @svn_log ($workurl2, $fileinfo['against']['created_rev'], $fileinfo['against']['created_rev'], 1, SVN_DISCOVER_CHANGED_PATHS);
+ if ($log === FALSE) $fileinfo['logmsg'] = '';
+ else $fileinfo['against']['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
+
return $fileinfo;
}
diff --git a/codepot/src/codepot/views/code_blame.php b/codepot/src/codepot/views/code_blame.php
index 46115a32..98502160 100644
--- a/codepot/src/codepot/views/code_blame.php
+++ b/codepot/src/codepot/views/code_blame.php
@@ -227,7 +227,6 @@ $this->load->view (
print '
-
- ' . $this->lang->line('History');
- $diff_anchor_text = '
' . $this->lang->line('Difference');
- $fulldiff_anchor_text = '
' . $this->lang->line('Full Difference');
- $blame_anchor_text = '
' . $this->lang->line('Blame');
+
+
+
+
+
+
+
+
+
+
+
+
load->view (
?>
- $k)
+ for ($i = 0; $i < $ms_count; $i++)
+ {
+ list($mp1, $mp2, $ml) = $ms[$i];
+ if ($mp1 > $k)
+ {
+ $cc .= sprintf ('
', $css_class);
+ $cc .= htmlspecialchars(substr($a, $k, $mp1 - $k));
+ $cc .= '';
+ }
+ $cc .= htmlspecialchars(substr($a, $mp1, $ml));
+ $k = $mp1 + $ml;
+ }
+ if ($k < strlen($a))
{
$cc .= sprintf ('
', $css_class);
- $cc .= htmlspecialchars(substr($a, $k, $mp1 - $k));
+ $cc .= htmlspecialchars(substr($a, $k));
$cc .= '';
}
- $cc .= htmlspecialchars(substr($a, $mp1, $ml));
- $k = $mp1 + $ml;
- }
- if ($k < strlen($a))
- {
- $cc .= sprintf ('
', $css_class);
- $cc .= htmlspecialchars(substr($a, $k));
- $cc .= '';
- }
- }
- else
- {
- for ($i = 0; $i < $ms_count; $i++)
- {
- list($mp1, $mp2, $ml) = $ms[$i];
- if ($mp2 > $k)
- {
- $cc .= sprintf ('
', $css_class);
- $cc .= htmlspecialchars(substr($b, $k, $mp2 - $k));
- $cc .= '';
- }
- $cc .= htmlspecialchars(substr($b, $mp2, $ml));
- $k = $mp2 + $ml;
- }
- if ($k < strlen($b))
- {
- $cc .= sprintf ('
', $css_class);
- $cc .= htmlspecialchars(substr($b, $k));
- $cc .= '';
- }
- }
-
-
- return $cc;
-}
-
-/*
-function format_diff ($a, $b, $css_class)
-{
- if ($b == '') return htmlspecialchars($a);
-
- // TODO: word by word comparison to be less position dependent
- $cc = '';
- $diffstart = -1;
- $alen = strlen($a);
- $blen = strlen($b);
-
- for ($i = 0; $i < $alen && $i < $blen; $i++)
- {
- if ($a[$i] == $b[$i])
- {
- if ($diffstart >= 0)
- {
- $cc .= sprintf ('
', $css_class);
- $cc .= htmlspecialchars(substr($a, $diffstart, $i - $diffstart));
- $cc .= '';
- $diffstart = -1;
- }
- $cc .= htmlspecialchars($a[$i]);
}
else
{
- if ($diffstart < 0) $diffstart = $i;
+ for ($i = 0; $i < $ms_count; $i++)
+ {
+ list($mp1, $mp2, $ml) = $ms[$i];
+ if ($mp2 > $k)
+ {
+ $cc .= sprintf ('
', $css_class);
+ $cc .= htmlspecialchars(substr($b, $k, $mp2 - $k));
+ $cc .= '';
+ }
+ $cc .= htmlspecialchars(substr($b, $mp2, $ml));
+ $k = $mp2 + $ml;
+ }
+ if ($k < strlen($b))
+ {
+ $cc .= sprintf ('
', $css_class);
+ $cc .= htmlspecialchars(substr($b, $k));
+ $cc .= '';
+ }
}
+
+
+ return $cc;
}
- if ($diffstart >= 0)
- {
- $cc .= sprintf ('
', $css_class);
- $cc .= htmlspecialchars(substr($a, $diffstart, $alen - $diffstart));
- $cc .= '';
- }
- else
- {
- if ($alen > $blen)
- {
- $cc .= sprintf ('
', $css_class);
- $cc .= htmlspecialchars(substr ($a, $blen, $alen - $blen));
- $cc .= '';
- }
- }
-
- return $cc;
-}
-*/
-
-//if (!$fullview)
-if (FALSE) // don't want to delete code for the original diff view.
-{
- print '
';
- /*
- print '';
- print_r ($file['content']);
- print '
';
- */
-
- print '';
- print '';
- print ' ';
-
- $currev = $file['created_rev'];
- $prevrev = $file['against']['prev_rev'];
- $prevanc = "code/diff/{$project->id}/{$xpar}/{$currev}/{$prevrev}";
- print anchor ($prevanc, '');
- print ' ';
-
- print $this->lang->line('Revision');
- print ' ';
- print $file['against']['created_rev'];
-
- $currev = $file['created_rev'];
- $nextrev = $file['against']['next_rev'];
- $nextanc = "code/diff/{$project->id}/{$xpar}/{$currev}/{$nextrev}";
- print ' ';
- print anchor ($nextanc, '');
-
- print ' | ';
-
- print '';
- print ' ';
-
- $currev = $file['against']['created_rev'];
- $prevrev = $file['prev_rev'];
- $prevanc = "code/diff/{$project->id}/{$xpar}/{$prevrev}/{$currev}";
- print anchor ($prevanc, '');
- print ' ';
-
- print $this->lang->line('Revision');
- print ' ';
- print $file['created_rev'];
-
- $currev = $file['against']['created_rev'];
- $nextrev = $file['next_rev'];
- $nextanc = "code/diff/{$project->id}/{$xpar}/{$nextrev}/{$currev}";
- print ' ';
- print anchor ($nextanc, '');
-
- print ' | ';
- print '
';
-
- if ($headpath != $file['fullpath'] ||
- $headpath != $file['against']['fullpath'])
- {
- print '';
-
- print '';
- print anchor (
- "code/file/{$project->id}/{$xpar}/{$file['against']['created_rev']}",
- htmlspecialchars ($file['against']['fullpath']));
- print ' | ';
-
- print '';
- print anchor (
- "code/file/{$project->id}/{$xpar}/{$file['created_rev']}",
- htmlspecialchars ($file['fullpath']));
- print ' | ';
-
- print '
';
- }
-
- if (empty($file['content']))
- {
- print '';
- print '';
- print htmlspecialchars ($this->lang->line('MSG_NO_DIFF'));
- print ' | ';
- print '
';
- }
- else
- {
- foreach ($file['content'] as $x)
- {
- print '';
-
- if (array_key_exists('rev1line', $x))
- {
- $diffclass = array_key_exists('rev1diffclass', $x)? $x['rev1diffclass']: 'diff';
- print "";
- print "";
- if ($x['rev1line'] == '') print ' ';
- else print htmlspecialchars($x['rev1line']);
- print ' ';
- print ' | ';
- }
- else
- {
- print '';
- print $x['rev1lineno'];
- print ' | ';
- }
-
- if (array_key_exists('rev2line', $x))
- {
- $diffclass = array_key_exists('rev2diffclass', $x)? $x['rev2diffclass']: 'diff';
- print "";
- print "";
- if ($x['rev2line'] == '') print ' ';
- else print htmlspecialchars($x['rev2line']);
- print ' ';
- print ' | ';
- }
- else
- {
- print '';
- print $x['rev2lineno'];
- print ' | ';
- }
-
- print '
';
- }
- }
-
- print '
';
-}
-else
-{
$http_user_agent = $_SERVER['HTTP_USER_AGENT'];
$is_msie = (stristr($http_user_agent, 'MSIE') !== FALSE &&
- stristr($http_user_agent, 'Opera') === FALSE);
+ stristr($http_user_agent, 'Opera') === FALSE);
if (!$is_msie) $is_msie = (preg_match ("/^Mozilla.+\(Windows.+\) like Gecko$/", $http_user_agent) !== FALSE);
- $diff_view = $fullview? 'fulldiff': 'diff';
-
print '
';
//
@@ -406,21 +362,21 @@ else
$currev = $file['created_rev'];
$prevrev = $file['against']['prev_rev'];
- $prevanc = "code/{$diff_view}/{$project->id}/{$xpar}/{$currev}/{$prevrev}";
+ $prevanc = "code/{$diff_view}/{$project->id}/{$hex_headpath}/{$currev}/{$prevrev}";
print anchor ($prevanc, '');
print ' ';
// show the history details of the previous revision at the root directory
$revanc = "code/revision/{$project->id}/!/{$file['against']['created_rev']}";
- $codeanc = "code/file/{$project->id}/{$xpar}/{$file['against']['created_rev']}";
+ $codeanc = "code/file/{$project->id}/{$hex_headpath}/{$file['against']['created_rev']}";
print anchor ($revanc, $this->lang->line('Revision'));
print ' ';
print anchor ($codeanc, $file['against']['created_rev']);
$currev = $file['created_rev'];
$nextrev = $file['against']['next_rev'];
- $nextanc = "code/{$diff_view}/{$project->id}/{$xpar}/{$currev}/{$nextrev}";
+ $nextanc = "code/{$diff_view}/{$project->id}/{$hex_headpath}/{$currev}/{$nextrev}";
print ' ';
print anchor ($nextanc, '');
print "
"; // navigator
@@ -511,20 +467,20 @@ else
$currev = $file['against']['created_rev'];
$prevrev = $file['prev_rev'];
- $prevanc = "code/{$diff_view}/{$project->id}/{$xpar}/{$prevrev}/{$currev}";
+ $prevanc = "code/{$diff_view}/{$project->id}/{$hex_headpath}/{$prevrev}/{$currev}";
print anchor ($prevanc, '
');
print ' ';
// show the history details of the current revision at the root directory
$revanc = "code/revision/{$project->id}/!/{$file['created_rev']}";
- $codeanc = "code/file/{$project->id}/${xpar}/{$file['created_rev']}";
+ $codeanc = "code/file/{$project->id}/{$hex_headpath}/{$file['created_rev']}";
print anchor ($revanc, $this->lang->line('Revision'));
print ' ';
print anchor ($codeanc, $file['created_rev']);
$currev = $file['against']['created_rev'];
$nextrev = $file['next_rev'];
- $nextanc = "code/{$diff_view}/{$project->id}/{$xpar}/{$nextrev}/{$currev}";
+ $nextanc = "code/{$diff_view}/{$project->id}/{$hex_headpath}/{$nextrev}/{$currev}";
print ' ';
print anchor ($nextanc, '
');
print "
"; // navigator
@@ -558,7 +514,7 @@ else
}
}
print '';
-
+
print '';
$actual_line_no = 1;
foreach ($file['content'] as $x)
@@ -611,8 +567,8 @@ else
print '';
-}
-?>
+
+ ?>
diff --git a/codepot/src/codepot/views/code_folder.php b/codepot/src/codepot/views/code_folder.php
index 30f2b779..8a7368e7 100644
--- a/codepot/src/codepot/views/code_folder.php
+++ b/codepot/src/codepot/views/code_folder.php
@@ -65,6 +65,7 @@
$fulldiff_anchor_text = ' ' . $this->lang->line('Full Difference');
$blame_anchor_text = ' ' . $this->lang->line('Blame');
+ $show_search = (CODEPOT_SIGNIN_FOR_CODE_SEARCH === FALSE || (isset($login['id']) && $login['id'] != ''));
?>