*/
function fetch_prev_revision($revision)
{
- $data = $this->fetch_node();
- $data = $data['history'];
-
+ $data = $this->fetch_node(($this->controller->path == '/' ? $this->controller->repos : $this->controller->path));
+ $data = $data['history'];
if (sizeof($data) < 1)
{
return $this->fetch_revision(0);
}
$list = array_keys($data);
-
$key = array_search($revision, $list);
+
+ if ($revision == 'HEAD')
+ {
+ $key = 0;
+ }
+
$key++; // go to the next earliest revision
if (!isset($list["$key"]))
{
*
* @access public
*
+ * @param string Node override
+ *
* @return integer Latest revision; FALSE if none (not in HEAD)
*/
- function fetch_node()
+ function fetch_node($node = false)
{
- $node = $this->fetch_node_string($this->controller->path);
+ $node = $this->fetch_node_string(($node === false ? $this->controller->path : $node));
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) . "'");