Ignore:
Timestamp:
Aug 7, 2000, 3:07:59 PM (25 years ago)
Author:
bird
Message:

Branches are working better now..
Although they're listed in reverse order.
Another feature is that CVS keywords are expanded on checkout - this is not
implemented yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/database/www/cvs.php3

    r3966 r3967  
    539539            $sRev = $this->aasKeys["head"][0];
    540540            $asText = $this->aasDeltas[$sRev];
    541             $sBranch = substr($sRevision, 0, strrpos($sRevision, ".")+1);
    542             //echo "<!-- \$sBranch=$sBranch -->";
    543541            do
    544542            {
     
    547545                 * (hope this works ok...)
    548546                 */
    549                 reset($this->aaasRevs[$sRev]["branches"]);
    550                 while (list($sIgnore, $sB) = each($this->aaasRevs[$sRev]["branches"]))
     547                $sPrevRev = $sRev;
     548                $asBranches = $this->aaasRevs[$sRev]["branches"];
     549                for ($f = 0, $i = 0; $i < sizeof($asBranches); $i++)
    551550                {
    552                     $sB = trim($sB);
    553                     if ($f = (substr($sB, 0, strrpos($sB, ".")+1) == $sBranch))
     551                    if (($sB = trim($asBranches[$i])) != "")
    554552                    {
    555                         $sRev = $sB;
    556                         break;
     553                        $sB2 = substr($sB, 0, strrpos($sB, ".") + 1);
     554                        if ($f = ($sB2 == substr($sRevision, 0, strlen($sB2))))
     555                        {
     556                            $sRev = $sB;
     557                            break;
     558                        }
    557559                    }
    558560                }
     561
    559562                if (!$f)    $sRev = $this->aaasRevs[$sRev]["next"][0];
    560                 //echo "<!-- \$sRev=$sRev -->";
     563                echo "<!-- \$sRev=$sRev -->";
    561564
    562565
     
    582585                    //apply it
    583586                    $c = (int)substr($this->aasDeltas[$sRev][$iDelta],
    584                                      strpos($this->aasDeltas[$sRev][$iDelta], " ") + 1);
    585                     $iDelta++;
     587                                     (int)strpos($this->aasDeltas[$sRev][$iDelta], " ") + 1);
    586588                    if ($this->aasDeltas[$sRev][$iDelta][0] == 'a')
    587589                    {
     590                        $iDelta++;
    588591                        while ($iDelta < $cDelta && $c-- > 0)
    589592                            $asText[$iText++] = $this->aasDeltas[$sRev][$iDelta++];
     
    593596                    }
    594597                    else
     598                    {
     599                        $iDelta++;
    595600                        $iOrg += $c;
     601                    }
    596602                }
    597603
     
    725731    function getBranch($sRev)
    726732    {
    727         if (strpos(strpos($sRev, "."), ".") <= 0)
     733        $aiDots = array();
     734
     735        for ($i = strlen($sRev) - 1; $i >= 0; $i--)
     736            if ($sRev[$i] == ".")
     737                $aiDots[] = $i;
     738
     739        if (sizeof($aiDots) == 1)
    728740            return "MAIN";
    729         return "<i>not implemented</i>"; //TODO FIXME
     741
     742        $sBranch = substr($sRev, 0, $aiDots[1]).".0";
     743        $cchBranch = strlen($sBranch);
     744        reset($this->aasKeys["symbols"]);
     745        while (list($sTag, $sTagRev) = each($this->aasKeys["symbols"]))
     746        {
     747            $j = strrpos($sTagRev, ".");
     748            //echo "<!-- $j  $cchBranch ($sBranch, ".substr($sTagRev, 0, $j).")-->";
     749            if ($cchBranch == $j && $sBranch == substr($sTagRev, 0, $j))
     750                return $sTag;
     751        }
     752
     753        return "";
    730754    }
    731755
     
    811835        echo "<table>\n";
    812836        //do we have to sort the array first? no...
    813         while (list($sRevision, $aasRev) = each($this->aaasRevs))
     837        $i = 0; //max is 256!!! (ChangeLog,v is _very_ big).
     838        while ($i++ < 256 && list($sRevision, $aasRev) = each($this->aaasRevs))
    814839        {
    815840            echo "<tr><td bgcolor=#d0dce0>Rev. <a href=\"cvs.php?sFile=$this->sDir/$this->sName,v&sRevision=$sRevision\"",
     
    858883
    859884        echo "</table>\n";
     885        return 1;
    860886    }
    861887}
Note: See TracChangeset for help on using the changeset viewer.