protected $_patchsets = true;
/**
+ * Does driver support branches?
+ *
+ * @var boolean
+ */
+ /* @TODO */
+ protected $_branches = false;
+
+ /**
* Constructor.
*
* @param array $params Any parameter the class expects.
// TODO: add options for $hr options - however these may not
// be compatible with some diffs.
- $command = $rep->getCommand() . " diff -M -C $options --no-color $rev1..$rev2 -- \"" . $file->queryModulePath() . '" 2>&1';
+ $command = $rep->getCommand() . " diff -M -C $options --no-color $rev1..$rev2 -- " . escapeshellarg($file->queryModulePath()) . ' 2>&1';
exec($command, $diff, $retval);
return $diff;
private function _getRevisionRange($rep, $file, $r1, $r2)
{
- $cmd = $rep->getCommand() . ' rev-list ' . $r1 . '..' . $r2 . ' -- "' . $file->queryModulePath() . '"';
+ $cmd = $rep->getCommand() . ' rev-list ' . $r1 . '..' . $r2 . ' -- ' . escapeshellarg($file->queryModulePath());
$pipe = popen($cmd, 'r');
if (!is_resource($pipe)) {
throw new Horde_Vcs_Exception('Unable to run ' . $cmd . ': ' . error_get_last());
public function browseDir($cache = null, $quicklog = true,
$showattic = false)
{
- //@TODO For now, we're browsing HEAD
- $head = trim(shell_exec($this->_rep->getCommand() . ' rev-parse --verify HEAD'));
+ //@TODO For now, we're browsing master
+ $head = trim(shell_exec($this->_rep->getCommand() . ' rev-parse --verify master'));
//@TODO can use this to see if we have a valid cache of the tree at this revision
$dir = $this->queryDir();
function getBrowseInfo()
{
// Get the list of revisions that touch this path
- $Q = VC_WINDOWS ? '"' : "'";
- $cmd = $this->rep->getCommand() . ' rev-list HEAD -- ' . $Q . str_replace($Q, '\\' . $Q, $this->fullname) . $Q . ' 2>&1';
+ $cmd = $this->rep->getCommand() . ' rev-list master -- ' . escapeshellarg($this->fullname) . ' 2>&1';
$revisions = shell_exec($cmd);
if (substr($revisions, 5) == 'fatal') {
throw new Horde_Vcs_Exception($revisions);
}
$this->revs = explode("\n", trim($revisions));
+
foreach ($this->revs as $rev) {
$this->logs[$rev] = Horde_Vcs_Log_Git::factory($this->rep, $this, $rev);
if ($this->quicklog) {
break;
}
}
+
+ // Add branch information
+ $cmd = $this->rep->getCommand() . ' branch -l';
+ $branch_list = shell_exec($cmd);
+ if (empty($branch_list)) {
+ throw new Horde_Vcs_Exception('No branches found');
+ }
+
+ $i = 0;
+ foreach (explode("\n", trim($branch_list)) as $val) {
+ $this->branches[++$i] = ltrim($val, '* ');
+ }
}
/**