$selAllBranches = '';
if ($VC->hasFeature('branches')) {
foreach (array_keys($fl->branches) as $sym) {
- $selAllBranches .= '<option value="' . $sym . '">' . $sym . '</option>';
+ $selAllBranches .= '<option value="' . $sym . '"' . ($sym == $onb ? ' selected="selected"' : '' ) . '>' . $sym . '</option>';
}
}
$i = 0;
foreach ($fl->logs as $lg) {
$rev = $lg->queryRevision();
- $branch_info = Chora::getBranch($fl, $rev);
+ $branch_info = $lg->queryBranch();
$textUrl = Chora::url('co', $where, array('r' => $rev));
$commitDate = Chora::formatDate($lg->queryDate());
Chora::url('co', $where, array('r' => $r, 'p' => 1)), _("Download"));
$tags = Chora::getTags($log, $where);
- $branch_info = Chora::getBranch($file, $r);
+ $branch_info = $log->queryBranch();
$log_print = Chora::formatLogMessage($log->queryLog());
$author = Chora::showAuthorName($log->queryAuthor(), true);
'rev' => $val,
'msg' => Chora::formatLogMessage($clog->queryLog()),
'author' => Chora::showAuthorName($clog->queryAuthor(), true),
- 'branchinfo' => Chora::getBranch($fl, $val),
+ 'branchinfo' => $clog->queryBranch(),
'date' => Chora::formatDate($clog->queryDate()),
'tags' => Chora::getTags($clog, $where),
);
}
/**
- * Return branch information for a given revision.
- *
- * @param Horde_Vcs_File $fl The Horde_Vcs_File object.
- * @param string $rev The revision string.
- *
- * @return array TODO
- */
- static public function getBranch($fl, $rev)
- {
- return $GLOBALS['VC']->hasFeature('branches')
- ? array_keys($fl->branches, $rev)
- : array();
-
- /*
- $rev_ob = $fl->rep->getRevisionObject();
- $branchRev = $rev_ob->strip($rev, 1);
- if (isset($fl->branches[$rev])) {
- $branchName = $fl->branches[$rev];
- } elseif (isset($fl->branches[$branchRev])) {
- $branchName = $fl->branches[$branchRev];
- }
- return array($branchName, $branchRev);
- */
- }
-
- /**
* Return formatted date information.
*
* @param integer $date Number of seconds since epoch we wish to display.
return $this->log;
}
+ public function queryBranch()
+ {
+ return array();
+ }
+
public function queryChangedLines()
{
return isset($this->lines) ? $this->lines : '';
array();
}
+ public function queryBranch()
+ {
+ $key = array_search($this->rev, $this->file->branches);
+ if ($key) {
+ return array($key);
+ }
+
+ $rev_ob = $this->file->rep->getRevisionObject();
+ $key = array_search($rev_ob->strip($this->rev, 1), $this->file->branches);
+ return $key ? array($key) : array();
+ }
+
}
/**
* @author Chuck Hagenbuch <chuck@horde.org>
* @package Horde_Vcs
*/
-class Horde_Vcs_Log_Git extends Horde_Vcs_Log {
-
- public $err;
+class Horde_Vcs_Log_Git extends Horde_Vcs_Log
+{
public $files = array();
public static function factory($file, $rev)
$cacheVersion = 1;
$cacheId = $file->rep->sourceroot() . '_r' . $rev . '_v' . $cacheVersion;
- /* @TODO: No caching during dev */
- if (0 &&
- $file->rep->cache &&
+ if ($file->rep->cache &&
// Individual revisions can be cached forever
+ // return array_keys(
$file->rep->cache->exists($cacheId, 0)) {
$logOb = unserialize($file->rep->cache->get($cacheId, 0));
$logOb->setRepository($file->rep);
return array();
}
+ public function queryBranch()
+ {
+ $branches = $ret = array();
+ $command = $this->rep->getCommand() . ' branch --contains ' . escapeshellarg($this->rev) . ' 2>&1';
+ exec($command, $branches);
+ return array_map('trim', $branches, array_fill(0, count($branches), '* '));
+ }
+
}
/**