[dev] Patch for svn patchsets
Jason Rust
jrust at rustyparts.com
Thu Jan 29 10:53:00 PST 2004
The attached patch fixes some bugs that were causing the patchsets
feature to not work properly with subversion repositories.
-Jason
-------------- next part --------------
Index: framework/VC/VC/svn.php
===================================================================
RCS file: /repository/framework/VC/VC/svn.php,v
retrieving revision 1.9
diff -u -r1.9 svn.php
--- framework/VC/VC/svn.php 22 Jan 2004 01:00:20 -0000 1.9
+++ framework/VC/VC/svn.php 29 Jan 2004 18:41:03 -0000
@@ -481,8 +481,9 @@
}
$cacheId = $filename . '_f' . (int)$quicklog . '_v' . $_cacheVersion;
- $fileOb = unserialize($cache->getData($cacheId, "serialize(SVNLib_File::_getFileObject('$filename', '$quicklog'))",
- time() - @filemtime($filename . ',v')));
+ // The file is cached for one hour no matter what, because there
+ // is no way to determine with svn the time the file last changed.
+ $fileOb = unserialize($cache->getData($cacheId, "serialize(SVNLib_File::_getFileObject('$filename', '$quicklog'))", time() - 360));
$fileOb->rep = &$rep;
Chora::checkError($fileOb->getBrowseInfo());
return $fileOb;
@@ -798,9 +799,8 @@
*
* @param string $file The filename to get patchsets for.
*/
- function SVNLib_Patchset(&$rep, $file)
+ function SVNLib_Patchset($file)
{
- $this->_rep = &$rep;
$this->_file = $file;
}
@@ -823,17 +823,18 @@
$cache = &Horde_Cache::singleton($conf['cache']['driver'], Horde::getDriverConfig('cache', $conf['cache']['driver']));
}
- $cacheId = $filename . '_f' . '_v' . $_cacheVersion;
- $psOb = unserialize($cache->getData($cacheId, "serialize(SVNLib_Patchset::_getPatchsetObject('$filename', '" . $rep->sourceroot() . "'))",
- time() - @filemtime($filename . ',v')));
- $psOb->rep = &$rep;
- Chora::checkError($psOb->getPatchsets($repository));
+ $cacheId = $filename . '_f_v' . $_cacheVersion;
+ // The file is cached for one hour no matter what, because there
+ // is no way to determine with svn the time the file last changed.
+ $psOb = unserialize($cache->getData($cacheId, "serialize(SVNLib_Patchset::_getPatchsetObject('$filename'))", time() - 360));
+ $psOb->_rep = &$rep;
+ Chora::checkError($psOb->getPatchsets($rep));
return $psOb;
}
- function &_getPatchsetObject(&$rep, $filename, $repository)
+ function &_getPatchsetObject($filename)
{
- $psOb = &new SVNLib_Patchset($rep, $filename);
+ $psOb = &new SVNLib_Patchset($filename);
return $psOb;
}
@@ -847,7 +848,7 @@
*/
function getPatchsets($repository)
{
- $fileOb = &new SVNLib_File($this->rep, $this->_file);
+ $fileOb = &new SVNLib_File($this->_rep, $this->_file);
Chora::checkError($fileOb->getBrowseInfo());
$this->_patchsets = array();
@@ -881,16 +882,6 @@
}
return true;
- }
-
- /**
- * Return the fully qualified filename of this object.
- *
- * @return Fully qualified filename of this object
- */
- function getFullPath()
- {
- return $this->_dir . DIRECTORY_SEPARATOR . $this->_name;
}
}
Index: chora/patchsets.php
===================================================================
RCS file: /repository/chora/patchsets.php,v
retrieving revision 1.11
diff -u -r1.11 patchsets.php
--- chora/patchsets.php 17 Jan 2004 22:57:25 -0000 1.11
+++ chora/patchsets.php 29 Jan 2004 18:41:03 -0000
@@ -36,8 +36,11 @@
$readableDate = VC_File::readableTime($patchset['date'], true);
$author = Chora::showAuthorName($patchset['author'], true);
if (is_a($VC, 'VC_svn')) {
+ // The diff should be from the top of the source
+ // tree so as to get all files
+ $topDir = substr($where, 0, strpos($where, '/', 1));
// Subversion supports patchset diffs natively
- $allDiffsLink = Horde::link(Chora::url('diff', dirname($where), array('r1' => $id - 1, 'r2' => $id, 'ty' => 'u')), _("Diff All Files")) . _("Diff All Files") . '</a>';
+ $allDiffsLink = Horde::link(Chora::url('diff', $topDir, array('r1' => $id - 1, 'r2' => $id, 'ty' => 'u')), _("Diff All Files")) . _("Diff All Files") . '</a>';
}
else {
// Not supported in any other VC systems yet
More information about the dev
mailing list