From: Michael M Slusarz Date: Fri, 19 Jun 2009 17:46:58 +0000 (-0600) Subject: Fix branch determination in CVS driver X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5f0d010d4f3b2d1a609faab5e9c2005a45466c3d;p=horde.git Fix branch determination in CVS driver --- diff --git a/framework/Vcs/lib/Horde/Vcs.php b/framework/Vcs/lib/Horde/Vcs.php index 7a1feec5e..5a4d713f2 100644 --- a/framework/Vcs/lib/Horde/Vcs.php +++ b/framework/Vcs/lib/Horde/Vcs.php @@ -598,7 +598,7 @@ class Horde_Vcs */ public function getDefaultBranch() { - return 'master'; + return 'HEAD'; } } @@ -841,7 +841,7 @@ abstract class Horde_Vcs_File /** * TODO */ - protected $_branch; + protected $_branch = null; /** * Create a repository file object, and give it information about diff --git a/framework/Vcs/lib/Horde/Vcs/Cvs.php b/framework/Vcs/lib/Horde/Vcs/Cvs.php index 1711fac18..cfdb295c1 100644 --- a/framework/Vcs/lib/Horde/Vcs/Cvs.php +++ b/framework/Vcs/lib/Horde/Vcs/Cvs.php @@ -457,29 +457,27 @@ class Horde_Vcs_File_Cvs extends Horde_Vcs_File $log = $rep->getLogObject($this, null); $rev = $log->queryRevision(); $onbranch = false; - $onhead = (substr_count($rev, '.') > 1); + $onhead = (substr_count($rev, '.') == 1); // Determine branch information. - if (!empty($branches)) { - if ($onhead) { - foreach ($branches as $key => $val) { - if (strpos($rev, $val) === 0) { - $onbranch = true; - $log->setBranch($key); - if (!isset($this->_branches[$key])) { - $this->_branches[$key] = $rev; - $this->_revlist[$key] = $rep->getRevisionRange($this, '1.1', $rev); - } - break; + if ($onhead) { + $onbranch = (empty($this->_branch) || $this->_branch == 'HEAD') || + ($rep->cmp($branches[$this->_branch], $rev) === 1); + } elseif ($this->_branch != 'HEAD') { + foreach ($branches as $key => $val) { + if (strpos($rev, $val) === 0) { + $onbranch = true; + $log->setBranch($key); + if (!isset($this->_branches[$key])) { + $this->_branches[$key] = $rev; + $this->_revlist[$key] = $rep->getRevisionRange($this, '1.1', $rev); } + break; } - } else { - $onbranch = $this->_branch && - ($rep->cmp($branches[$this->_branch], $rev) === 1); } } - if (!$this->_branch || $onbranch) { + if ($onbranch) { $this->_revs[] = $rev; $this->_logs[$rev] = $log; }