v3.0-git
--------
+[mms] Patchset page supports viewing a single patchset.
[mms] Add configuration option to disable caching.
[mms] Move log entries in annotate screen to an AJAX request.
[mms] Add support for git repositories.
Chora::fatal(sprintf(_("%s: no such file or directory"), $where), '404 Not Found');
}
+$ps_opts = array();
+if ($ps_id = Util::getFormData('ps')) {
+ $ps_opts['range'] = array($ps_id);
+}
+
try {
- $ps = $VC->getPatchsetObject($where);
+ $ps = $VC->getPatchsetObject($where, $ps_opts);
$patchsets = $ps->getPatchsets();
} catch (Horde_Vcs_Exception $e) {
Chora::fatal($e);
Horde::addScriptFile('prototype.js', 'horde', true);
Horde::addScriptFile('tables.js', 'horde', true);
-Horde::addScriptFile('QuickFinder.js', 'horde', true);
+
+// JS search not needed if showing a single patchset
+if ($ps_id) {
+ $full_ps_link = Horde::link(Chora::url('patchsets', $where)) . _("View All Patchsets for File") . '</a>';
+} else {
+ Horde::addScriptFile('QuickFinder.js', 'horde', true);
+}
+
require CHORA_TEMPLATES . '/common-header.inc';
require CHORA_TEMPLATES . '/menu.inc';
require CHORA_TEMPLATES . '/headerbar.inc';
<table class="options" cellspacing="0">
<tr>
<td>
+<?php if ($ps_id): ?>
+ <?php echo $full_ps_link ?>
+<?php else: ?>
<?php echo _("Search Patchsets:") ?>
<input type="text" for="patchsets_body" size="20" />
+<?php endif; ?>
</td>
</tr>
</table>
/**
* TODO
*/
- public function getPatchsetObject($filename)
+ public function getPatchsetObject($filename, $opts = array())
{
$class = 'Horde_Vcs_Patchset_' . $this->_driver;
- $cacheId = implode('|', array($class, $this->sourceroot(), $filename, $this->_cacheVersion));
+ ksort($opts);
+ $cacheId = implode('|', array($class, $this->sourceroot(), $filename, serialize($opts), $this->_cacheVersion));
if (!empty($this->_cache)) {
// TODO: Can't use filemtime() - Git bare repos contain no files
}
}
- $ob = new $class($this, $filename);
+ $ob = new $class($this, $filename, $opts);
if (!empty($this->_cache)) {
$this->_cache->set($cacheId, serialize($ob));
*
* @param Horde_Vcs $rep A Horde_Vcs repository object.
* @param string $file The filename to create patchsets for.
+ * @param array $opts Additional options:
+ * <pre>
+ * 'range' - (array) The patchsets to process.
+ * DEFAULT: None (all patchsets are processed).
+ * </pre>
*/
- abstract public function __construct($rep, $file);
+ abstract public function __construct($rep, $file, $opts = array());
/**
* TODO
*
* @param Horde_Vcs $rep A Horde_Vcs repository object.
* @param string $file The filename to create a patchset for.
+ * @param array $opts Additional options.
+ * <pre>
+ * 'range' - (array) The patchsets to process.
+ * DEFAULT: None (all patchsets are processed).
+ * </pre>
*
* @throws Horde_Vcs_Exception
*/
- public function __construct($rep, $file)
+ public function __construct($rep, $file, $opts = array())
{
$file = $rep->sourceroot() . '/' . $file;
'HOME=' . escapeshellarg($cvsps_home) . ' ' :
'';
+ $rangecmd = empty($opts['range'])
+ ? ''
+ : ' -s ' . escapeshellarg(implode(',', $opts['range']));
+
$ret_array = array();
- $cmd = $HOME . escapeshellcmd($rep->getPath('cvsps')) . ' -u --cvs-direct --root ' . escapeshellarg($rep->sourceroot()) . ' -f ' . escapeshellarg(basename($file)) . ' ' . escapeshellarg(dirname($file));
+ $cmd = $HOME . escapeshellcmd($rep->getPath('cvsps')) . $rangecmd . ' -u --cvs-direct --root ' . escapeshellarg($rep->sourceroot()) . ' -f ' . escapeshellarg(basename($file)) . ' ' . escapeshellarg(dirname($file));
exec($cmd, $ret_array, $retval);
if ($retval) {
throw new Horde_Vcs_Exception('Failed to spawn cvsps to retrieve patchset information.');
*
* @param Horde_Vcs $rep A Horde_Vcs repository object.
* @param string $file The filename to create patchsets for.
+ * @param array $opts Additional options.
+ * <pre>
+ * 'range' - (array) The patchsets to process.
+ * DEFAULT: None (all patchsets are processed).
+ * </pre>
*/
- public function __construct($rep, $file)
+ public function __construct($rep, $file, $opts = array())
{
$fileOb = $rep->getFileObject($file);
+ $revs = array();
+
+ if (empty($opts['range'])) {
+ $revs = $fileOb->queryLogs();
+ } else {
+ foreach ($opts['range'] as $val) {
+ $revs[$val] = $fileOb->queryLogs($val);
+ }
+ }
- foreach ($fileOb->queryLogs() as $rev => $log) {
+ reset($revs);
+ while(list($rev, $log) = each($revs)) {
$this->_patchsets[$rev] = array(
'date' => $log->queryDate(),
'author' => $log->queryAuthor(),