<?php
/**
- * Horde_Vcs log class.
+ * Horde_Vcs_Log class.
*
* Copyright 2008-2010 The Horde Project (http://www.horde.org/)
*
protected $_log;
protected $_state;
protected $_lines = '';
+ protected $_branch;
protected $_branches = array();
+ protected $_symbolicBranches = array();
+
+ /**
+ * @var boolean
+ */
+ protected $_initialized;
/**
* Constructor.
protected function _ensureInitialized()
{
+ if (!$this->_initialized) {
+ $this->_init();
+ $this->_initialized = true;
+ }
}
/**
public function queryBranch()
{
$this->_ensureInitialized();
- return array();
+ return $this->_branch;
}
/**
public function querySymbolicBranches()
{
$this->_ensureInitialized();
+ return $this->_symbolicBranches;
+ }
- $symBranches = array();
+ protected function _setSymbolicBranches()
+ {
+ $this->_symbolicBranches = array();
$branches = $this->_file->queryBranches();
foreach ($this->_branches as $branch) {
if (($key = array_search($branch, $branches)) !== false) {
- $symBranches[$key] = $branch;
+ $this->_symbolicBranches[$key] = $branch;
}
}
-
- return $symBranches;
}
/**
*/
protected $_branch;
- private $_initialized;
-
protected function _init()
{
- $raw = $this->_file->getAccum();
+ $raw = $this->_file->getAccum();
/* Initialise a simple state machine to parse the output of rlog */
$state = 'init';
/* Assume the rest of the lines are the log message */
$this->_log = implode("\n", $raw);
$this->_tags = $this->_file->queryRevsym($this->_rev);
- }
- protected function _ensureInitialized()
- {
- if (!$this->_initialized) {
- $this->_init();
- $this->_initialized = true;
- }
+ $this->_setSymbolicBranches();
+
+ $branches = $this->_file->queryBranches();
+ $key = array_keys($branches, $this->_rev);
+ $this->_branch = empty($key)
+ ? array_keys($branches, $this->_rep->strip($this->_rev, 1))
+ : $key;
}
/**
{
$this->_branch = array($branch);
}
-
- /**
- * TODO
- */
- public function queryBranch()
- {
- if (!empty($this->_branch)) {
- return $this->_branch;
- }
-
- $branches = $this->_file->queryBranches();
- $key = array_keys($branches, $this->_rev);
- return empty($key)
- ? array_keys($branches, $this->_rep->strip($this->_rev, 1))
- : $key;
- }
-
}
\ No newline at end of file
*/
protected $_parent = null;
- /**
- * @var boolean
- */
- private $_initialized;
-
- protected function _ensureInitialized()
- {
- if (!$this->_initialized) {
- $this->_init();
- $this->_initialized = true;
- }
- }
-
protected function _init()
{
/* Get diff statistics. */
$line = next($lines);
}
+
+ $this->_setSymbolicBranches();
+ $this->_branch = $this->_file->queryBranch($this->_rev);
}
/**
/**
* TODO
*/
- public function queryBranch()
- {
- return $this->_file->queryBranch($this->_rev);
- }
-
- /**
- * TODO
- */
public function queryParent()
{
return $this->_parent;
}
-
}
\ No newline at end of file