? $conf['options']['introTitle']
: sprintf(_("Source Directory of /%s"), $where);
- $extraLink = '';
- if (is_a($VC, 'VC_cvs')) {
- $extraLink = Horde::widget(Chora::url(
- '', $where . '/', array('sa' => ($acts['sa'] ? 0 : 1))),
- $acts['sa'] ? _("Hide Deleted Files") : _("Show Deleted Files"),
- 'widget', '', '',
- $acts['sa'] ? _("Hide _Deleted Files") : _("Show _Deleted Files")
- );
- }
+ $extraLink = $VC->supportsFeature('deleted')
+ ? Horde::widget(Chora::url('', $where . '/', array('sa' => ($acts['sa'] ? 0 : 1))), $acts['sa'] ? _("Hide Deleted Files") : _("Show Deleted Files"), 'widget', '', '', $acts['sa'] ? _("Hide _Deleted Files") : _("Show _Deleted Files"))
+ : '';
$umap = array(
'age' => Horde_Vcs::SORT_AGE,
require_once dirname(__FILE__) . '/lib/base.php';
// Exit if cvsgraph isn't active or it's not supported.
-if (empty($conf['paths']['cvsgraph']) || is_a($VC, 'VC_svn')) {
+if (empty($conf['paths']['cvsgraph']) || !$VC->supportsFeature('branches')) {
header('Location: ' . Chora::url('', $where));
exit;
}
require_once dirname(__FILE__) . '/lib/base.php';
/* Exit if it's not supported. */
-if (is_a($VC, 'VC_svn')) {
+if (!$VC->supportsFeature('branches')) {
header('Location: ' . Chora::url('browse', $where));
exit;
}
? '<em class="widget">' . _("Logs") . '</em>'
: Horde::widget(Chora::url('', $where), _("Logs"), 'widget', '',
'', _("_Logs"));
- // Subversion supports patchsets natively.
+
if (!empty($GLOBALS['conf']['paths']['cvsps']) ||
- is_a($GLOBALS['VC'], 'VC_svn')) {
+ $GLOBALS['VC']->supportsFeature('patchsets')) {
$views[] = $current == 'patchsets'
? '<em class="widget">' . _("Patchsets") . '</em>'
: Horde::widget(Chora::url('patchsets', $where), _("Patchsets"),
'widget', '', '', _("_Patchsets"));
}
- if (!is_a($GLOBALS['VC'], 'VC_svn')) {
+
+ if ($GLOBALS['VC']->supportsFeature('branches')) {
if (empty($GLOBALS['conf']['paths']['cvsgraph'])) {
$views[] = $current == 'history'
? '<em class="widget">' . _("Branches") . '</em>'
require_once dirname(__FILE__) . '/lib/base.php';
// Exit if cvsps isn't active or it's not a subversion repository.
-if (empty($conf['paths']['cvsps']) && !is_a($VC, 'VC_svn')) {
+if (empty($conf['paths']['cvsps']) &&
+ !$GLOBALS['VC']->supportsFeature('patchsets')) {
header('Location: ' . Chora::url('', $where));
exit;
}
$commitDate = Chora::formatTime($patchset['date']);
$readableDate = Chora::readableTime($patchset['date'], true);
$author = Chora::showAuthorName($patchset['author'], true);
- if (is_a($VC, 'VC_svn')) {
+ if ($VC->supportsFeature('patchsets')) {
// The diff should be from the top of the source tree so as to
// get all files.
$topDir = substr($where, 0, strpos($where, '/', 1));
$dir = dirname($where);
foreach ($patchset['members'] as $member) {
$file = array();
- $mywhere = is_a($VC, 'VC_svn') ? $member['file'] : $dir . '/' . $member['file'];
+ $mywhere = ($VC->supportsFeature('patchsets')) ? $member['file'] : $dir . '/' . $member['file'];
$file['file'] = Horde::link(Chora::url('patchsets', $mywhere)) . htmlspecialchars($member['file']) . '</a>';
if ($member['from'] == 'INITIAL') {
$file['from'] = '<ins>' . _("New File") . '</ins>';
protected $_cached = array();
/**
+ * Does driver support deleted files?
+ *
+ * @var boolean
+ */
+ protected $_deleted = false;
+
+ /**
+ * Does driver support patchsets?
+ *
+ * @var boolean
+ */
+ protected $_patchsets = false;
+
+ /**
+ * Does driver support branches?
+ *
+ * @var boolean
+ */
+ protected $_branches = false;
+
+ /**
* Attempts to return a concrete Horde_Vcs instance based on $driver.
*
* @param mixed $driver The type of concrete Horde_Vcs subclass to return.
}
/**
+ * Does this driver support the given feature
+ *
+ * @return boolean True if driver supports the given feature.
+ */
+ public function supportsFeature($feature)
+ {
+ switch ($feature) {
+ case 'branches':
+ return $this->_branches;
+
+ case 'deleted':
+ return $this->_deleted;
+
+ case 'patchsets':
+ return $this->_patchsets;
+
+ default:
+ return false;
+ }
+ }
+
+ /**
* Return the source root for this repository, with no trailing /
*
* @return string Source root for this repository.
class Horde_Vcs_cvs extends Horde_Vcs_rcs
{
/**
+ * Does driver support deleted files?
+ *
+ * @var boolean
+ */
+ protected $_deleted = true;
+
+ /**
+ * Does driver support branches?
+ *
+ * @var boolean
+ */
+ protected $_branches = true;
+
+ /**
* Constructor.
*
* @param array $params Any parameter the class expects.
protected $_password = '';
/**
+ * Does driver support patchsets?
+ *
+ * @var boolean
+ */
+ protected $_patchsets = true;
+
+ /**
* Constructor.
*
* @param array $params Any parameter the class expects.