/* Spawn the file object. */
$fl = $VC->getFileObject($where, $cache);
+$rev_ob = $VC->getRevisionObject();
Chora::checkError($fl);
/* Retrieve the desired revision from the GET variable. */
Chora::fatal(sprintf(_("$s: no such file or directory"), $where), '404 Not Found');
}
+$rev_ob = $VC->getRevisionObject();
+
if ($atdir) {
Chora::checkError($dir = $VC->queryDir($where));
'author' => Horde_Vcs::SORT_AUTHOR
);
- foreach (array('age', 'rev', 'name', 'author') as $u) {
- $arg = array('sbt' => $umap[$u]);
- if ($acts['sbt'] == $umap[$u]) {
+ foreach ($umap as $key => $val) {
+ $arg = array('sbt' => $val);
+ if ($acts['sbt'] == $val) {
$arg['ord'] = !$acts['ord'];
}
- $url[$u] = Chora::url('', $where . '/', $arg);
+ $url[$key] = Chora::url('', $where . '/', $arg);
}
/* Print out the directory header. */
/* Showing a file. */
$fl = $VC->getFileObject($where, $cache);
-$rev_ob = $VC->getRevisionObject();
Chora::checkError($fl);
$title = sprintf(_("Revisions for %s"), $where);
$onb = Util::getFormData('onb', 0);
/* Spawn the repository and file objects */
$fl = $VC->getFileObject($where, $cache);
+$rev_ob = $VC->getRevisionObject();
Chora::checkError($fl);
/* Initialise the form variables correctly. */
}
/* Human-Readable diff. */
+$abbrev_r1 = $rev_ob->abbrev($r1);
+$abbrev_r2 = $rev_ob->abbrev($r2);
$title = sprintf(_("Diff for %s between version %s and %s"),
- Text::htmlallspaces($where), $r1, $r2);
+ Text::htmlallspaces($where), $abbrev_r1, $abbrev_r2);
/* Format log entries. */
$log = &$fl->logs;
/* Spawn the file object. */
$fl = $VC->getFileObject($where, $cache);
+$rev_ob = $VC->getRevisionObject();
Chora::checkError($fl);
/* $trunk contains an array of trunk revisions. */
* array. Otherwise, add it to an array in $branches[$branch]. */
foreach ($fl->logs as $log) {
$rev = $log->queryRevision();
- $baseRev = VC_Revision::strip($rev, 1);
+ $baseRev = $rev_ob->strip($rev, 1);
$branchFound = false;
foreach ($fl->branches as $branch => $name) {
if ($branch == $baseRev) {
}
/* If its not a branch, then add it to the trunk. */
/* TODO: this silently drops vendor branches atm! - avsm. */
- if (!$branchFound && VC_Revision::sizeof($rev) == 2) {
+ if (!$branchFound && $rev_ob->sizeof($rev) == 2) {
array_unshift($trunk, $rev);
}
}
$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 (!strcmp($rev, $rev_ob->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
/* Otherwise, this cell has content; determine what it is. */
$rev = $row[$i];
- if ($VC->isValidRevision($rev) && (VC_Revision::sizeof($rev) % 2)) {
+ if ($VC->isValidRevision($rev) && ($rev_ob->sizeof($rev) % 2)) {
/* This is a branch point, so put the info out. */
$bg = isset($branchColours[$rev]) ? $branchColours[$rev] : '#e9e9e9';
$symname = $fl->branches[$rev];
} elseif (preg_match('|^:|', $rev)) {
/* This is a continuation cell, so render it with the
* branch colour. */
- $bgbr = VC_Revision::strip(preg_replace('|^\:|', '', $rev), 1);
+ $bgbr = $rev_ob->strip(preg_replace('|^\:|', '', $rev), 1);
$bg = isset($branchColours[$bgbr]) ? $branchColours[$bgbr] : '#e9e9e9';
require CHORA_TEMPLATES . '/history/blank.inc';
} elseif ($VC->isValidRevision($rev)) {
/* This cell contains a revision, so render it. */
- $bgbr = VC_Revision::strip($rev, 1);
+ $bgbr = $rev_ob->strip($rev, 1);
$bg = isset($branchColours[$bgbr]) ? $branchColours[$bgbr] : '#e9e9e9';
$log = $fl->logs[$rev];
$author = Chora::showAuthorName($log->queryAuthor());
<tr id="l<?php echo $lineno ?>">
<td class="rightAlign"><?php echo $lineno ?></td>
<td class="author"><?php echo $author ?></td>
- <td class="rev"><a id="rev_<?php echo $rev . '_' . $i ?>" href="<?php echo Chora::url('co', $where, array('r' => $rev)) ?>"><?php echo $rev ?></a></td>
- <td class="rev"><?php if ($prev): ?><a id="prev_<?php echo $prev . '_' . $i ?>" href="<?php echo Chora::url('annotate', $where, array('rev' => $prev)) . '#l' . $lineno ?>"><?php echo $prev ?></a><?php else: ?> <?php endif; ?></td>
+ <td class="rev"><a id="rev_<?php echo $rev . '_' . $i ?>" href="<?php echo Chora::url('co', $where, array('r' => $rev)) ?>" title="<?php echo $rev ?>"><?php echo $rev_ob->abbrev($rev) ?></a></td>
+ <td class="rev"><?php if ($prev): ?><a id="prev_<?php echo $prev . '_' . $i ?>" href="<?php echo Chora::url('annotate', $where, array('rev' => $prev)) . '#l' . $lineno ?>" title="<?php echo $prev ?>"><?php echo $rev_ob->abbrev($prev) ?></a><?php else: ?> <?php endif; ?></td>
<td class="item<?php echo $style ?>"><tt><?php echo (trim($line) != '') ? $line : ' ' ?></tt></td>
</tr>
<?php if (!empty($val['branchName'])): ?><li><?php echo _("Branch:") ?> <strong><a href="<?php echo Chora::url('', $where, array('onb' => $val['branchRev'])) ?>"><?php echo $val['branchName'] ?></a></strong></li><?php endif; ?>
<?php if (!empty($val['tags'])): ?><li class="tags"><?php echo _("Tags:") ?> <?php echo implode(', ', $val['tags']) ?></li><?php endif; ?>
</ul>
- <a href="<?php echo Chora::url('co', $where, array('r' => $val['rev'])) ?>"><?php echo $val['rev'] ?></a>: <?php echo $val['msg'] ?>
+ <a href="<?php echo Chora::url('co', $where, array('r' => $val['rev'])) ?>" title="<?php echo $val['rev'] ?>"><?php echo $rev_ob->abbrev($val['rev']) ?></a>: <?php echo $val['msg'] ?>
<div class="diffclear"></div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<thead>
<tr>
- <th><a href="<?php echo Chora::url('co', $where, array('r' => $r1)) ?>"><?php printf(_("Version %s"), $r1) ?></a></th>
- <th><a href="<?php echo Chora::url('co', $where, array('r' => $r2)) ?>"><?php printf(_("Version %s"), $r2) ?></a></th>
+ <th><a href="<?php echo Chora::url('co', $where, array('r' => $r1)) ?>" title="<?php echo $r1 ?>"><?php printf(_("Version %s"), $abbrev_r1) ?></a></th>
+ <th><a href="<?php echo Chora::url('co', $where, array('r' => $r2)) ?>" title="<?php echo $r2 ?>"><?php printf(_("Version %s"), $abbrev_r2) ?></a></th>
</tr>
</thead>
<tbody>
<td>
<strong>
<?php if ($conf['filename_linkto'] == 'revlog'): ?>
- <a href="<?php echo Chora::url('co', $fileName, array('r' => $head)) ?>">
+ <a href="<?php echo Chora::url('co', $fileName, array('r' => $head)) ?>" title="<?php echo $head ?>">
<?php else: ?>
- <a href="<?php echo $url ?>">
+ <a href="<?php echo $url ?>" title="<?php echo $head ?>">
<?php endif; ?>
-<?php echo $head ?></a></strong>
+<?php echo $rev_ob->abbrev($head) ?></a></strong>
</td>
<?php else: ?>
<td>
<?php endif; ?>
<?php echo $name ?>
</td>
- <td><strong><?php echo $head ?></strong></td>
+ <td><strong><?php echo $rev_ob->abbrev($head) ?></strong></td>
<?php endif; ?>
<td><?php echo $author ?></td>
<td sortval="<?php echo (int)$date ?>">
<?php endif ?>
<a href="<?php echo Chora::url('diff', $where, array('r1' => 0, 'r2' => $rev)) ?>" class="sdiff" title="<?php echo _("Show changes to the selected revision") ?>" onclick="revlog_sdiff(this);"><?php echo Horde::img('diff.png') ?></a>
</td>
- <td><a href="<?php echo $textUrl ?>"><?php echo $rev . '</a>'; if ($branchName) echo ' <span class="branch">' . Horde::link(Chora::url('', $where, array('onb' => $branchRev))) . htmlspecialchars($branchName) . '</a></span>'; if (!empty($lg->lines)) echo ' <small>(' . sprintf('%s lines', $lg->lines) . ')</small>'; ?></td>
+ <td><a href="<?php echo $textUrl ?>" title="<?php echo $rev ?>"><?php echo $rev_ob->abbrev($rev) . '</a>'; if ($branchName) echo ' <span class="branch">' . Horde::link(Chora::url('', $where, array('onb' => $branchRev))) . htmlspecialchars($branchName) . '</a></span>'; if (!empty($lg->lines)) echo ' <small>(' . sprintf('%s lines', $lg->lines) . ')</small>'; ?></td>
<td class="ago" sortval="<?php echo (int)$lg->date ?>"><a title="<?php echo $readableDate ?>"><?php echo $commitDate ?></a></td>
<td class="author"><?php echo $author ?></td>
<td class="log">
while (!feof($pipe)) {
$line = rtrim(fgets($pipe, 4096));
- if (!$line) {
- continue;
- }
- if ($line[0] == "\t") {
+ if (!$line || ($line[0] == "\t")) {
$lines[] = array(
'author' => $db[$curr_rev]['author'] . ' ' . $db[$curr_rev]['author-mail'],
'date' => $db[$curr_rev]['author-time'],
- 'line' => substr($line, 1),
+ 'line' => $line ? substr($line, 1) : '',
'lineno' => $line_num++,
'rev' => $curr_rev
);
break;
}
} else {
- list($curr_rev, , $line_num, $lines_group) = explode(' ', $line);
+ $curr_line = explode(' ', $line);
+ $curr_rev = $curr_line[0];
+ $line_num = $curr_line[2];
+ $lines_group = isset($curr_line[3]) ? $curr_line[3] : 1;
}
}
}