Ignore:
Timestamp:
Aug 7, 2000, 12:40:40 PM (25 years ago)
Author:
bird
Message:

Most merges is ok. branches don't work 100%.

File:
1 edited

Legend:

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

    r3965 r3966  
    299299                        {
    300300                            if ($iColon = strpos($sVal, ":"))
    301                                 $asValue[substr($sVal, 0, $iColon-1)] = substr($sVal, $iColon+1);
     301                                $asValue[substr($sVal, 0, $iColon)] = substr($sVal, $iColon+1);
    302302                            else
    303303                                echo "\n<!-- error in symbols parsing -->\n";
     
    406406     * Prints the contents of the file to stdout.
    407407     *
    408      * Color coding is enabled. (TODO)
     408     * Color coding is enabled.
    409409     *
    410410     * Currently only $sRevision == head revision is supported
     
    420420        {
    421421            $this->sError = "CVSFile::PrintRevision is called with an invalid revision number. ($sRevision)";
    422             return 0;
    423         }
    424         /* to-be-removed - TODO - FIXME */
    425         if ($sRevision != $this->aasKeys["head"][0])
    426         {
    427             $this->sError = "CVSFile::PrintRevision is called with an invalid revision number (not head).";
    428422            return 0;
    429423        }
     
    511505         */
    512506        $Timer = Odin32DBTimerStart("Write timer");
    513         echo "<tr><td bgcolor=#020286><pre><font size=-0 face=\"System VIO, System Monospaced\" color=#02FEFE>\n";
    514 
    515         for ($cLines = sizeof($this->aasDeltas[$sRevision]), $iLine = 0;
    516              ($iLine < $cLines);
    517              $iLine++)
    518         {
     507        echo "<tr><td bgcolor=#020286><pre><font size=-0 face=\"System VIO, System Monospaced\" color=#02FEFE>";
     508        if ($sRevision == $this->aasKeys["head"][0])
     509        {
     510            //head revision
     511            for ($cLines = sizeof($this->aasDeltas[$sRevision]), $iLine = 0;
     512                 ($iLine < $cLines);
     513                 $iLine++)
     514            {
     515                /*
     516                 * Preprocessing... Color coding
     517                 */
     518                echo "<a name=$iLine>";
     519                switch ($iColorEncoder)
     520                {
     521                    case 1:
     522                        echo  str_replace("\t", "    ", C_ColorEncode(htmlspecialchars($this->aasDeltas[$sRevision][$iLine]), $aVariables));
     523                        break;
     524                    case 2:
     525                        echo  str_replace("\t", "    ", ASM_ColorEncode(htmlspecialchars($this->aasDeltas[$sRevision][$iLine]), $aVariables));
     526                        break;
     527                    case 3:
     528                        echo  str_replace("\t", "    ", Make_ColorEncode(htmlspecialchars($this->aasDeltas[$sRevision][$iLine]), $aVariables));
     529                        break;
     530                    default:
     531                        echo  str_replace("\t", "    ", htmlspecialchars($this->aasDeltas[$sRevision][$iLine]));
     532                }
     533                echo "</a>";
     534            }
     535        }
     536        else
     537        {
     538            //build revision
     539            $sRev = $this->aasKeys["head"][0];
     540            $asText = $this->aasDeltas[$sRev];
     541            $sBranch = substr($sRevision, 0, strrpos($sRevision, ".")+1);
     542            //echo "<!-- \$sBranch=$sBranch -->";
     543            do
     544            {
     545                /*
     546                 * determin revision.
     547                 * (hope this works ok...)
     548                 */
     549                reset($this->aaasRevs[$sRev]["branches"]);
     550                while (list($sIgnore, $sB) = each($this->aaasRevs[$sRev]["branches"]))
     551                {
     552                    $sB = trim($sB);
     553                    if ($f = (substr($sB, 0, strrpos($sB, ".")+1) == $sBranch))
     554                    {
     555                        $sRev = $sB;
     556                        break;
     557                    }
     558                }
     559                if (!$f)    $sRev = $this->aaasRevs[$sRev]["next"][0];
     560                //echo "<!-- \$sRev=$sRev -->";
     561
     562
     563                /*
     564                 * Apply the delta.
     565                 */
     566                $asOrg  = $asText;
     567                $asText = array();
     568                $iOrg   = 0;
     569                $cOrg   = sizeof($asOrg);
     570                $iDelta = 0;
     571                $cDelta = sizeof($this->aasDeltas[$sRev]);
     572                $iText  = 0;
     573                while ($cDelta > $iDelta)
     574                {
     575                    //get the next diff chunk
     576                    $iDiff = (int)substr($this->aasDeltas[$sRev][$iDelta], 1, strpos($this->aasDeltas[$sRev], " ") - 1) - 1;
     577
     578                    //skip to it
     579                    while ($iDiff > $iOrg && $iOrg < $cOrg)
     580                        $asText[$iText++] = $asOrg[$iOrg++];
     581
     582                    //apply it
     583                    $c = (int)substr($this->aasDeltas[$sRev][$iDelta],
     584                                     strpos($this->aasDeltas[$sRev][$iDelta], " ") + 1);
     585                    $iDelta++;
     586                    if ($this->aasDeltas[$sRev][$iDelta][0] == 'a')
     587                    {
     588                        while ($iDelta < $cDelta && $c-- > 0)
     589                            $asText[$iText++] = $this->aasDeltas[$sRev][$iDelta++];
     590
     591                        while ($c-- > 0)
     592                            $asText[$iText++] = "";
     593                    }
     594                    else
     595                        $iOrg += $c;
     596                }
     597
     598                //copy remaining
     599                while ($iOrg < $cOrg)
     600                    $asText[$iText++] = $asOrg[$iOrg++];
     601
     602            } while ($sRev != "" && $sRev != $sRevision);
     603
    519604            /*
    520              * Preprocessing... Color coding
     605             * Print it
    521606             */
    522             echo "<a name=$iLine>";
    523             switch ($iColorEncoder)
     607            for ($cLines = sizeof($asText), $iLine = 0; $iLine < $cLines; $iLine++)
    524608            {
    525                 case 1:
    526                     echo  str_replace("\t", "    ", C_ColorEncode(htmlspecialchars($this->aasDeltas[$sRevision][$iLine]), $aVariables));
    527                     break;
    528                 case 2:
    529                     echo  str_replace("\t", "    ", ASM_ColorEncode(htmlspecialchars($this->aasDeltas[$sRevision][$iLine]), $aVariables));
    530                     break;
    531                 case 3:
    532                     echo  str_replace("\t", "    ", Make_ColorEncode(htmlspecialchars($this->aasDeltas[$sRevision][$iLine]), $aVariables));
    533                     break;
    534                 default:
    535                     echo  str_replace("\t", "    ", htmlspecialchars($this->aasDeltas[$sRevision][$iLine]));
     609                /*
     610                 * Preprocessing... Color coding
     611                 */
     612                echo "<a name=$iLine>";
     613                switch ($iColorEncoder)
     614                {
     615                    case 1:
     616                        echo  str_replace("\t", "    ", C_ColorEncode(htmlspecialchars($asText[$iLine]), $aVariables));
     617                        break;
     618                    case 2:
     619                        echo  str_replace("\t", "    ", ASM_ColorEncode(htmlspecialchars($asText[$iLine]), $aVariables));
     620                        break;
     621                    case 3:
     622                        echo  str_replace("\t", "    ", Make_ColorEncode(htmlspecialchars($asText[$iLine]), $aVariables));
     623                        break;
     624                    default:
     625                        echo  str_replace("\t", "    ", htmlspecialchars($asText[$iLine]));
     626                }
     627                echo "</a>";
    536628            }
    537             echo "</a>";
    538         }
    539 
     629        }
    540630        echo "                                                                               \n", //80-columns line
    541631             "</pre></td></tr></table>\n";
Note: See TracChangeset for help on using the changeset viewer.