Esempio n. 1
0
function populateGrid($row, $col)
{
    global $grid, $branches;
    /* Figure out the starting revision this function uses */
    $rev = $grid[$row][$col];
    /* For every branch that is known, try to see if it forks here */
    $brkeys = array_keys($branches);
    /* NOTE: do not optimise to use foreach () or each() here, as that
     * really screws up the $branches pointer array due to the
     * recursion, and parallel branches fail - avsm */
    for ($a = 0; $a < sizeof($brkeys); $a++) {
        $brrev = $brkeys[$a];
        $brcont = $branches[$brrev];
        /* Check to see if current point matches a branch point */
        if (!strcmp($rev, VC_Revision::strip($brrev, 1))) {
            /* If it does, figure out how many rows we have to add */
            $numRows = sizeof($brcont);
            /* Check rows in columns to the right, until one is free */
            $insCol = $col + 1;
            while (true) {
                /* Look in the current column for a set value */
                $inc = false;
                for ($i = $row; $i <= $row + $numRows; $i++) {
                    if (isset($grid[$i][$insCol])) {
                        $inc = true;
                    }
                }
                /* If a set value was found, shift to the right and
                 * try again.  Otherwise, break out of the loop */
                if ($inc) {
                    if (!isset($grid[$row][$insCol])) {
                        $grid[$row][$insCol] = ':' . $brcont[0];
                    }
                    $insCol++;
                } else {
                    break;
                }
            }
            /* Put a fork marker in the top of the branch */
            $grid[$row][$insCol] = $brrev;
            /* Populate the grid with the branch values at this point */
            for ($i = 0; $i < $numRows; $i++) {
                $grid[1 + $i + $row][$insCol] = $brcont[$i];
            }
            /* For each value just set, check for sub-branches,
             * - but in reverse (VERY IMPORTANT!) */
            for ($i = $numRows - 1; $i >= 0; $i--) {
                populateGrid(1 + $i + $row, $insCol);
            }
        }
    }
}
Esempio n. 2
0
/**
 * $Horde: chora/annotate.php,v 1.43 2004/01/17 22:57:25 jan Exp $
 *
 * Copyright 2000-2004 Anil Madhavapeddy <*****@*****.**>
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */
define('CHORA_BASE', dirname(__FILE__));
require_once CHORA_BASE . '/lib/base.php';
/* Spawn the file object. */
$fl =& $VC->getFileObject($where);
/* Retrieve the desired revision from the GET variable. */
$rev = Util::getFormData('rev', '1.1');
if (!VC_Revision::valid($rev)) {
    Chora::fatal('404 Not Found', "Revision {$rev} not found");
}
$ann =& $VC->getAnnotateObject($fl);
Chora::checkError($lines = $ann->doAnnotate($rev));
$title = sprintf(_("Source Annotation of %s for version %s"), Text::htmlAllSpaces($where), $rev);
$extraLink = sprintf('<a href="%s">%s</a> <b>|</b> <a href="%s">%s</a>', Chora::url('co', $where, array('r' => $rev)), _("View"), Chora::url('co', $where, array('r' => $rev, 'p' => 1)), _("Download"));
require CHORA_TEMPLATES . '/common-header.inc';
Chora::menu();
require CHORA_TEMPLATES . '/headerbar.inc';
require CHORA_TEMPLATES . '/annotate/header.inc';
$author = '';
$style = 0;
foreach ($lines as $line) {
    $lineno = $line['lineno'];
    $prevAuthor = $author;
Esempio n. 3
0
    case 's':
        $type = 'column';
        break;
    case 'c':
        $type = 'context';
        break;
    case 'e':
        $type = 'ed';
        break;
    case 'u':
    case 'h':
    default:
        $type = 'unified';
}
/* Ensure that we have valid revision numbers. */
if (!VC_Revision::valid($r1) || !VC_Revision::valid($r2)) {
    Chora::fatal(_("Malformed Query"));
}
/* Cache the output of the diff for a week - it can be longer, since
 * it should never change */
header('Cache-Control: max-age=604800');
/* Title to use for html output pages */
$title = sprintf(_("Diff for %s between version %s and %s"), Text::htmlallspaces($where), $r1, $r2);
/* All is ok, proceed with the diff */
switch ($type) {
    case 'column':
        /* We'll need to know the mime type to modify diffs based on the mime
           type. */
        require_once HORDE_LIBS . 'Horde/MIME/Magic.php';
        $mime_type = MIME_Magic::filenameToMIME($fullname);
        if ($browser->isViewable($mime_type)) {
Esempio n. 4
0
 $commitDate = strftime('%c', $lg->date);
 $readableDate = VC_File::readableTime($lg->date, true);
 $aid = $lg->queryAuthor();
 $author = Chora::showAuthorName($aid, true);
 if (!empty($lg->tags)) {
     $commitTags = implode(', ', $lg->tags);
 } else {
     $commitTags = '';
 }
 $branchPointsArr = array();
 foreach ($lg->querySymbolicBranches() as $symb => $bra) {
     $branchPointsArr[] = '<a href="' . Chora::url('cvs', $where, array('onb' => $bra)) . '">' . $symb . '</a>';
 }
 /* Calculate the current branch name and revision. */
 $branchPoints = implode(' , ', $branchPointsArr);
 $branchRev = VC_Revision::strip($rev, 1);
 if (@isset($fl->branches[$branchRev])) {
     $branchName = $fl->branches[$branchRev];
 } else {
     $branchName = '';
 }
 if ($prevRevision = $fl->queryPreviousRevision($lg->queryRevision())) {
     $changedLines = $lg->queryChangedLines();
     $coloredDiffURL = Chora::url('diff', $where, array('r1' => $prevRevision, 'r2' => $rev, 'ty' => 'h'));
     $longDiffURL = Chora::url('diff', $where, array('r1' => $prevRevision, 'r2' => $rev, 'ty' => 'h', 'num' => 10));
     $uniDiffURL = Chora::url('diff', $where, array('r1' => $prevRevision, 'r2' => $rev, 'ty' => 'u'));
     $nowsDiffURL = Chora::url('diff', $where, array('ws' => 0, 'r1' => $prevRevision, 'r2' => $rev, 'ty' => 'u'));
 }
 $manyRevisions = !($fl->queryRevision() === '1.1');
 if ($manyRevisions) {
     $selCvsURL = Chora::url('cvs', $where, array('r1' => $rev, 'onb' => $onb));
Esempio n. 5
0
        } else {
            $commitTags = '';
        }
        $branchPointsArr = array();
        foreach ($log->querySymbolicBranches() as $symb => $bra) {
            $branchPointsArr[] = '<a href="' . Chora::url('cvs', $where, array('onb' => $bra)) . '">' . $symb . '</a>';
        }
        /* Calculate the current branch name and revision. */
        $branchPoints = implode(' , ', $branchPointsArr);
        $branchRev = VC_Revision::strip($r, 1);
        if (@isset($fl->branches[$branchRev])) {
            $branchName = $fl->branches[$branchRev];
        } else {
            $branchName = '';
        }
        if ($prevRevision = VC_Revision::prev($log->queryRevision())) {
            $changedLines = $log->queryChangedLines();
        }
        $log_print = Chora::formatLogMessage($log->queryLog());
        $i = 0;
        require CHORA_TEMPLATES . '/common-header.inc';
        Chora::menu();
        require CHORA_TEMPLATES . '/headerbar.inc';
        require CHORA_TEMPLATES . '/checkout/checkout.inc';
        require $registry->getParam('templates', 'horde') . '/common-footer.inc';
    } else {
        header('Content-Type: ' . $pretty->getType());
        echo $pretty->render();
    }
    exit;
} else {