From cd97f8de3c37b97d2c1c57a5f1816497ab5ca4ba Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 9 Jan 2006 02:06:49 +0000 Subject: [PATCH] Changing empty fetch_rev_(str|num)() calls to the cached version in Paths --- blame.php | 12 ++++++------ browse.php | 22 +++++++++++----------- diff.php | 2 +- includes/paths.php | 16 +++++++++++++++- includes/svnlib.php | 4 ++-- view.php | 14 +++++++------- 6 files changed, 42 insertions(+), 28 deletions(-) diff --git a/blame.php b/blame.php index 84bc152..863709f 100644 --- a/blame.php +++ b/blame.php @@ -30,24 +30,24 @@ $navbar = $viewsvn->paths->construct_breadcrumb($viewsvn->paths->path, false); // ################################################################### -$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $viewsvn->paths->path); +$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path); -$show['head'] = ($viewsvn->svn->common->fetch_head_rev($viewsvn->paths->path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD'); +$show['head'] = ($viewsvn->svn->common->fetch_head_rev($viewsvn->paths->path) != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD'); if ($show['head']) { $link['gohead'] = $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $viewsvn->paths->path); - $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $viewsvn->paths->path); + $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum), $viewsvn->paths->path); } -$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($viewsvn->paths->path, $viewsvn->paths->fetch_rev_num())) != -1 ? true : false); +$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($viewsvn->paths->path, $viewsvn->paths->revnum)) != -1 ? true : false); if ($show['prev']) { - $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $viewsvn->paths->path); + $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->revnum, $prev), $viewsvn->paths->path); } // ################################################################### -$blame = new SVNBlame($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->fetch_rev_num()); +$blame = new SVNBlame($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->revnum); $lines = ''; diff --git a/browse.php b/browse.php index 5e259d0..2903846 100644 --- a/browse.php +++ b/browse.php @@ -30,28 +30,28 @@ $navbar = $viewsvn->paths->construct_breadcrumb($viewsvn->paths->path); // ################################################################### -$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $viewsvn->paths->path); +$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path); -$show['head'] = ($viewsvn->svn->common->fetch_head_rev($viewsvn->paths->path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD'); +$show['head'] = ($viewsvn->svn->common->fetch_head_rev($viewsvn->paths->path) != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD'); if ($show['head']) { $link['gohead'] = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $viewsvn->paths->path); - $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $viewsvn->paths->path); + $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum), $viewsvn->paths->path); } -$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($viewsvn->paths->path, $viewsvn->paths->fetch_rev_num())) != -1 ? true : false); +$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($viewsvn->paths->path, $viewsvn->paths->revnum)) != -1 ? true : false); if ($show['prev']) { - $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $viewsvn->paths->path); + $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->revnum, $prev), $viewsvn->paths->path); } // ################################################################### -$revinfo = $viewsvn->svn->common->fetch_log($viewsvn->paths->path, $viewsvn->paths->fetch_rev_num()); +$revinfo = $viewsvn->svn->common->fetch_log($viewsvn->paths->path, $viewsvn->paths->revnum); $revinfo['message_clean'] = $viewsvn->svn->format_log_message($revinfo['message']); -$listing = $viewsvn->svn->ls($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->fetch_rev_num()); +$listing = $viewsvn->svn->ls($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->revnum); $nodes = ''; @@ -60,16 +60,16 @@ foreach ($listing AS $item) if ($item{ strlen($item) - 1 } == '/') { $show['directory'] = true; - $browse = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(), $viewsvn->paths->path . $item); + $browse = $viewsvn->paths->out('browse.php' . $viewsvn->paths->revstr, $viewsvn->paths->path . $item); } else { $show['directory'] = false; - $view = $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(), $viewsvn->paths->path . $item); - $blame = $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(), $viewsvn->paths->path . $item); + $view = $viewsvn->paths->out('view.php' . $viewsvn->paths->revstr, $viewsvn->paths->path . $item); + $blame = $viewsvn->paths->out('blame.php' . $viewsvn->paths->revstr, $viewsvn->paths->path . $item); } - $log = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $viewsvn->paths->path . $item); + $log = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path . $item); eval('$nodes .= "' . $template->fetch('browse_node') . '";'); } diff --git a/diff.php b/diff.php index 11d6b4c..a9ad012 100644 --- a/diff.php +++ b/diff.php @@ -34,7 +34,7 @@ $navbar = $viewsvn->paths->construct_breadcrumb($viewsvn->paths->path, false); // ################################################################### -$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $viewsvn->paths->path); +$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path); // ################################################################### diff --git a/includes/paths.php b/includes/paths.php index 98b24fd..74b93e2 100644 --- a/includes/paths.php +++ b/includes/paths.php @@ -60,6 +60,18 @@ class Paths */ var $relpath; + /** + * The current revision number + * @var integer + */ + var $revnum; + + /** + * The current revision as a string argument + * @var string + */ + var $revstr; + /** * Constructor: determine the type of linking to use * @@ -77,6 +89,8 @@ class Paths $this->type = (int)$type; $this->path = $this->parse(); + $this->revnum = $this->revnum; + $this->revstr = $this->revstr; } /** @@ -180,7 +194,7 @@ class Paths { $itembit .= $item; $itembit .= (($count != $val OR @$viewsvn->svn->common->isdir($itembit)) ? '/' : ''); - $html .= '' . $item . ''. ($count != $val ? ' / ' : ''); + $html .= '' . $item . ''. ($count != $val ? ' / ' : ''); } return $html; diff --git a/includes/svnlib.php b/includes/svnlib.php index 0c47a1b..8ed39ba 100644 --- a/includes/svnlib.php +++ b/includes/svnlib.php @@ -438,7 +438,7 @@ class SVNCommon */ function isdir($path) { - $output = $this->registry->svn->std('info', $this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), $this->registry->paths->fetch_rev_num()); + $output = $this->registry->svn->std('info', $this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), $this->registry->paths->revnum); foreach ($output AS $line) { @@ -557,7 +557,7 @@ class SVNCommon { if (!isset($this->logs["$path"])) { - $log = new SVNLog($this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), 0, $this->registry->paths->fetch_rev_num()); + $log = new SVNLog($this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), 0, $this->registry->paths->revnum); $this->logs["$path"] = $log->fetch(); } diff --git a/view.php b/view.php index ce3314c..9c2b5f8 100644 --- a/view.php +++ b/view.php @@ -29,29 +29,29 @@ $navbar = $viewsvn->paths->construct_breadcrumb($viewsvn->paths->path); // ################################################################### -$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $viewsvn->paths->path); +$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path); -$show['head'] = ($viewsvn->svn->common->fetch_head_rev($viewsvn->paths->path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD'); +$show['head'] = ($viewsvn->svn->common->fetch_head_rev($viewsvn->paths->path) != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD'); if ($show['head']) { $link['gohead'] = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $viewsvn->paths->path); - $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $viewsvn->paths->path); + $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum), $viewsvn->paths->path); } -$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($viewsvn->paths->path, $viewsvn->paths->fetch_rev_num())) != -1 ? true : false); +$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($viewsvn->paths->path, $viewsvn->paths->revnum)) != -1 ? true : false); if ($show['prev']) { - $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $viewsvn->paths->path); + $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->revnum, $prev), $viewsvn->paths->path); } // ################################################################### -$logmsg = $viewsvn->svn->common->fetch_log($viewsvn->paths->path, $viewsvn->paths->fetch_rev_num()); +$logmsg = $viewsvn->svn->common->fetch_log($viewsvn->paths->path, $viewsvn->paths->revnum); unset($logmsg['files']); $logmsg['message_clean'] = $viewsvn->svn->format_log_message($logmsg['message']); -$catdata = implode("\n", $viewsvn->svn->cat($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->fetch_rev_num())); +$catdata = implode("\n", $viewsvn->svn->cat($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->revnum)); // get language information require_once('./includes/file_types.php'); -- 2.43.5