Horde::addScriptFile('tables.js', 'horde', true);
if ($atdir) {
+ $rev = $VC->hasFeature('snapshots')
+ ? Util::getFormData('rev')
+ : null;
+
try {
$atticFlags = (bool)$acts['sa'];
- $dir = $VC->getDirObject($where, array('quicklog' => true, 'showattic' => $atticFlags));
+ $dir = $VC->getDirObject($where, array('quicklog' => true, 'rev' => $rev, 'showattic' => $atticFlags));
$dir->applySort($acts['sbt'], $acts['ord']);
$dirList = $dir->queryDirList();
$fileList = $dir->queryFileList($atticFlags);
Horde::widget(Chora::url('annotate', $where, array('rev' => $r)), _("Annotate"), 'widget', '', '', _("_Annotate")),
Horde::widget(Chora::url('co', $where, array('r' => $r, 'p' => 1)), _("Download"), 'widget', '', '', _("_Download"))
);
+ if ($VC->hasFeature('snapshots')) {
+ $snapdir = dirname($file->queryPath());
+ $views[] = Horde::widget(Chora::url('browse', $snapdir == '.' ? '' : $snapdir, array('rev' => $r)), _("Snapshot"), 'widget', '', '', _("_Snapshot"));
+ }
$extraLink = _("View:") . ' ' . implode(' | ', $views);
$tags = Chora::getTags($log, $where);
protected $_branches = false;
/**
+ * Does driver support snapshots?
+ *
+ * @var boolean
+ */
+ protected $_snapshots = false;
+
+ /**
+ * Current cache version.
+ *
* @var integer
*/
protected $_cacheVersion = 3;
case 'patchsets':
return $this->_patchsets;
+ case 'snapshots':
+ return $this->_snapshots;
+
default:
return false;
}
*
* $opts:
* 'quicklog' - (boolean)
+ * 'rev' - (string)
* 'showAttic' - (boolean)
*/
public function getDirObject($where, $opts = array())
protected $_branches = true;
/**
+ * Does driver support snapshots?
+ *
+ * @var boolean
+ */
+ protected $_snapshots = true;
+
+ /**
* The available diff types.
*
* @var array
{
parent::__construct($rep, $dn, $opts);
- // @TODO For now, we're browsing master
- $branch = 'master';
+ $branch = empty($opts['rev']) ? 'master' : $opts['rev'];
// @TODO can use this to see if we have a valid cache of the tree at this revision
$cmd = $rep->getCommand() . ' ls-tree --full-name ' . escapeshellarg($branch) . ' ' . escapeshellarg($dir) . ' 2>&1';
- $dir = popen($cmd, 'r');
- if (!$dir) {
+ $stream = popen($cmd, 'r');
+ if (!$stream) {
throw new Horde_Vcs_Exception('Failed to execute git ls-tree: ' . $cmd);
}
// Create two arrays - one of all the files, and the other of
// all the dirs.
- while (!feof($dir)) {
- $line = chop(fgets($dir, 1024));
+ while (!feof($stream)) {
+ $line = chop(fgets($stream, 1024));
+ print "$line\n";
if (!strlen($line)) {
continue;
}
}
}
- pclose($dir);
+ pclose($stream);
}
}