Making all classes that are subservient to Node_Controller not have to pass info...
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 22 Jan 2006 06:53:12 +0000 (06:53 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 22 Jan 2006 06:53:12 +0000 (06:53 +0000)
browse.php
includes/cachev.php
includes/svnlib.php

index e01213ee506699af4a2baa798ce9df6ff737fa8e..75c728447c137a6568af94a890f4c24ce486bbfc 100644 (file)
@@ -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 = '';
 
index e70af2f09ad2535f6ac07e9106686f26a84866a1..a780e117ceee2f899adf31c8dc0c2991f8fe6214 100644 (file)
@@ -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) . "'");
index 415d4960f9a3df949927eb9d1aba3b49e8b56792..0c2776b4dcc76f17b00c6cacf7de46393e408bd7 100644 (file)
@@ -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');
        }
 }