From e29e69c46104660aa81e6046e112314ed23aa713 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 22 Jan 2006 06:53:12 +0000 Subject: [PATCH] Making all classes that are subservient to Node_Controller not have to pass info along via args --- browse.php | 10 +++++----- includes/cachev.php | 17 ++++++----------- includes/svnlib.php | 22 ++++++++-------------- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/browse.php b/browse.php index e01213e..75c7284 100644 --- a/browse.php +++ b/browse.php @@ -30,19 +30,19 @@ $navbar = $controller->construct_breadcrumb(); // ################################################################### -$node = preg_replace('#(^/|/$)#', '', ($viewsvn->paths->relpath == '' ? $viewsvn->paths->path : $viewsvn->paths->relpath)); -$latest = $controller->cachev->fetch_node($node); +//$node = preg_replace('#(^/|/$)#', '', ($viewsvn->paths->relpath == '' ? $viewsvn->paths->path : $viewsvn->paths->relpath)); +$latest = $controller->cachev->fetch_node(); $link['log'] = $controller->href_compound('log.php'); -$show['head'] = ($latest['revision'] != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD'); +$show['head'] = ($latest['revision'] != $controller->revnum AND $controller->revnum != 'HEAD'); if ($show['head']) { $link['gohead'] = $controller->href_compound('browse.php', null, Paths::fetch_rev_str(false, 'HEAD')); $link['diffhead'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(true, 'HEAD', $controller->revnum)); } -$show['prev'] = ($prev = $controller->cachev->fetch_prev_revision($viewsvn->paths->relpath, $viewsvn->paths->revnum)); +$show['prev'] = ($prev = $controller->cachev->fetch_prev_revision($controller->revnum)); if ($show['prev']) { $link['diffprev'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(true, $controller->revnum, $prev)); @@ -55,7 +55,7 @@ $revinfo = $controller->cachev->fetch_revision($latest['revision']); $revinfo['message_clean'] = SVNCommon::format_log_message($revinfo['message']); $revinfo['date'] = SVNCommon::format_date_string($revinfo['dateline']); -$listing = $controller->library->ls($controller->repos, $controller->path, $controller->revnum); +$listing = $controller->library->command('ls'); $nodes = ''; diff --git a/includes/cachev.php b/includes/cachev.php index e70af2f..a780e11 100644 --- a/includes/cachev.php +++ b/includes/cachev.php @@ -132,14 +132,13 @@ class cacheV * * @access public * - * @param string Node path * @param integer Revision number * * @return array Complete revision/commit entry */ - function fetch_prev_revision($node, $revision) + function fetch_prev_revision($revision) { - $data = $this->fetch_node($node); + $data = $this->fetch_node(); $data = $data['history']; if (count($data['history']) < 1) @@ -158,13 +157,11 @@ class cacheV * * @access public * - * @param string Node path - * * @return integer HEAD revision */ - function fetch_head_revision($node) + function fetch_head_revision() { - $data = $this->fetch_node($node); + $data = $this->fetch_node(); $data = $data['history']; return max(array_keys($data)); @@ -176,13 +173,11 @@ class cacheV * * @access public * - * @param string Node path - * * @return integer Latest revision; FALSE if none (not in HEAD) */ - function fetch_node($node) + function fetch_node() { - $node = $this->fetch_node_string($node); + $node = $this->fetch_node_string($this->controller->path); if (!isset($this->memcache['nodes']["$node"])) { $result = $this->controller->registry->db->query_first("SELECT * FROM {$this->hash}_nodes WHERE name = '" . $this->controller->registry->escape($node) . "'"); diff --git a/includes/svnlib.php b/includes/svnlib.php index 415d496..0c2776b 100644 --- a/includes/svnlib.php +++ b/includes/svnlib.php @@ -100,23 +100,19 @@ class SVNLib /** * SVN Wrapper: standard command system * - * @access private + * @access public * * @param string SVN command - * @param string Repository - * @param string Path - * @param integer Revision * * @return array Lines of output */ - function std($command, $repos, $path, $revision) + function command($command) { global $viewsvn; - $revision = SVNCommon::rev($revision); - $repospath = $viewsvn->repos->fetch_path($repos, false); + $revision = SVNCommon::rev($this->controller->revnum); - return $this->svn($command . ' ' . $repospath . $path . '@' . $revision); + return $this->svn($command . ' ' . $this->controller->repospath . $this->controller->path . '@' . $revision); } /** @@ -234,17 +230,15 @@ class SVNLib /** * SVN Wrapper: ls (list) * - * @access protected + * @access public * - * @param string Repository - * @param string Path - * @param integer Revision + * @param object Controller object * * @return array Lines of list output */ - function ls($repos, $path, $revision) + function ls(&$controller) { - return $this->std('list', $repos, $path, $revision); + return $this->std('list'); } } -- 2.43.5