: sprintf(_("Source Directory of /%s"), $where);
$extraLink = $VC->hasFeature('deleted')
- ? Horde::widget(Chora::url('browsedir', $where . '/', array('sa' => ($acts['sa'] ? 0 : 1))), $acts['sa'] ? _("Hide Deleted Files") : _("Show Deleted Files"), 'widget', '', '', $acts['sa'] ? _("Hide _Deleted Files") : _("Show _Deleted Files"))
+ ? Horde::widget(Chora::url('browsedir', $where . '/', array('rev' => $rev, 'sa' => ($acts['sa'] ? 0 : 1))), $acts['sa'] ? _("Hide Deleted Files") : _("Show Deleted Files"), 'widget', '', '', $acts['sa'] ? _("Hide _Deleted Files") : _("Show _Deleted Files"))
: '';
$umap = array(
if ($acts['sbt'] == $val) {
$arg['ord'] = !$acts['ord'];
}
- $url[$key] = Chora::url('browsedir', $where . '/', $arg);
+ $url[$key] = Chora::url('browsedir', $where . '/', $arg, array('rev' => $rev));
}
$branches = array();
if ($VC->hasFeature('branches')) {
$branches = $dir->getBranches();
- if ($rev === null) {
+ if (is_null($rev)) {
$rev = $dir->getDefaultBranch();
}
}
/* Unless we're at the top, display the 'back' bar. */
if ($where != '') {
- $url = Chora::url('browsedir', preg_replace('|[^/]+$|', '', $where));
+ $url = Chora::url('browsedir', preg_replace('|[^/]+$|', '', $where), array('rev' => $rev));
require CHORA_TEMPLATES . '/directory/back.inc';
}
if ($conf['hide_restricted'] && Chora::isRestricted($currentDir)) {
continue;
}
- $url = Chora::url('browsedir', $where . '/' . $currentDir . '/');
+ $url = Chora::url('browsedir', $where . '/' . $currentDir . '/', array('rev' => $rev));
$currDir = Horde_Text_Filter::filter($currentDir, 'space2html', array('charset' => NLS::getCharset(), 'encode' => true, 'encode_all' => true));
require CHORA_TEMPLATES . '/directory/dir.inc';
}
$attic = $currFile->isDeleted();
$fileName = $where . ($attic ? '/' . 'Attic' : '') . '/' . $realname;
$name = Horde_Text_Filter::filter($realname, 'space2html', array('charset' => NLS::getCharset(), 'encode' => true, 'encode_all' => true));
- $url = Chora::url('browsefile', $fileName);
+ $url = Chora::url('browsefile', $fileName, array('onb' => $rev));
$readableDate = Chora::readableTime($date);
if ($log) {
$shortLog = str_replace("\n", ' ', trim(substr($log, 0, $conf['options']['shortLogLength'] - 1)));
);
if ($VC->hasFeature('snapshots')) {
$snapdir = dirname($file->queryPath());
- $views[] = Horde::widget(Chora::url('browsedir', $snapdir == '.' ? '' : $snapdir, array('rev' => $r)), _("Snapshot"), 'widget', '', '', _("_Snapshot"));
+ $views[] = Horde::widget(Chora::url('browsedir', $snapdir == '.' ? '' : $snapdir . '/', array('rev' => $r)), _("Snapshot"), 'widget', '', '', _("_Snapshot"));
}
$extraLink = _("View:") . ' ' . implode(' | ', $views);
return substr($rev, 0, 7) . '[...]';
}
+ /**
+ * TODO
+ */
public function getBranchList()
{
if (!isset($this->_branchlist)) {
class Horde_Vcs_Directory_Git extends Horde_Vcs_Directory
{
/**
+ * The current branch.
+ *
+ * @var string
+ */
+ protected $_branch;
+
+ /**
* Create a Directory object to store information about the files in a
* single directory in the repository.
*
{
parent::__construct($rep, $dn, $opts);
- $branch = empty($opts['rev']) ? 'master' : $opts['rev'];
+ $this->_branch = empty($opts['rev']) ? 'master' : $opts['rev'];
// @TODO See if we have a valid cache of the tree at this revision
$dir .= '/';
}
- $cmd = $rep->getCommand() . ' ls-tree --full-name ' . escapeshellarg($branch) . ' ' . escapeshellarg($dir) . ' 2>&1';
+ $cmd = $rep->getCommand() . ' ls-tree --full-name ' . escapeshellarg($this->_branch) . ' ' . escapeshellarg($dir) . ' 2>&1';
$stream = popen($cmd, 'r');
if (!$stream) {
throw new Horde_Vcs_Exception('Failed to execute git ls-tree: ' . $cmd);
if ($type == 'tree') {
$this->_dirs[] = basename($file);
} else {
- $this->_files[] = $rep->getFileObject($file, array('branch' => $branch, 'quicklog' => !empty($opts['quicklog'])));
+ $this->_files[] = $rep->getFileObject($file, array('branch' => $this->_branch, 'quicklog' => !empty($opts['quicklog'])));
}
}
*/
public function getBranches()
{
- return array_keys($this->_rep->getBranchList());
+ $blist = array_keys($this->_rep->getBranchList());
+ if (!in_array($this->_branch, $blist)) {
+ $blist[] = $this->_branch;
+ }
+ return $blist;
}
/**
/* Get the list of revisions. Need to get all revisions, not just
* those on $this->_branch, for branch determination reasons. */
- foreach (array_keys($rep->getBranchList()) as $key) {
+ foreach (array_keys($this->queryBranches()) as $key) {
$revs = array();
$cmd = $rep->getCommand() . ' rev-list ' . escapeshellarg($key) . ' -- ' . escapeshellarg($this->queryModulePath()) . ' 2>&1';
exec($cmd, $revs);
*/
public function queryBranches()
{
- return $this->_rep->getBranchList();
+ /* If dealing with a branch that is not explicitly named (i.e. an
+ * implicit branch for a given tree-ish commit ID), we need to add
+ * that information to the branch list. */
+ $revlist = $this->_rep->getBranchList();
+ if (!empty($this->_branch) &&
+ !in_array($this->_branch, $revlist)) {
+ $revlist[$this->_branch] = $this->_branch;
+ }
+ return $revlist;
}
/**