From: Michael M Slusarz Date: Tue, 6 Jan 2009 18:58:05 +0000 (-0700) Subject: Chora/VCS fixes merged from CVS HEAD. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=244faa495da11206160e23bbc4a1963a53356e89;p=horde.git Chora/VCS fixes merged from CVS HEAD. --- diff --git a/chora/annotate.php b/chora/annotate.php index 5508f4bde..9f76e0a27 100644 --- a/chora/annotate.php +++ b/chora/annotate.php @@ -14,6 +14,7 @@ require_once 'Horde/Text/Filter.php'; /* Spawn the file object. */ $fl = $VC->getFileObject($where, $cache); +$rev_ob = $VC->getRevisionObject(); Chora::checkError($fl); /* Retrieve the desired revision from the GET variable. */ diff --git a/chora/browse.php b/chora/browse.php index c24b1fd36..8e9878b66 100644 --- a/chora/browse.php +++ b/chora/browse.php @@ -16,6 +16,8 @@ if (!$atdir && !$VC->isFile($fullname)) { 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)); @@ -47,12 +49,12 @@ if ($atdir) { '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. */ @@ -130,7 +132,6 @@ if ($atdir) { /* 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); diff --git a/chora/diff.php b/chora/diff.php index 072db81f7..91ec2391f 100644 --- a/chora/diff.php +++ b/chora/diff.php @@ -13,6 +13,7 @@ require_once dirname(__FILE__) . '/lib/base.php'; /* Spawn the repository and file objects */ $fl = $VC->getFileObject($where, $cache); +$rev_ob = $VC->getRevisionObject(); Chora::checkError($fl); /* Initialise the form variables correctly. */ @@ -65,8 +66,10 @@ if ($type != 'colored') { } /* 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; diff --git a/chora/history.php b/chora/history.php index 1ec1878c8..2a58ab7c4 100644 --- a/chora/history.php +++ b/chora/history.php @@ -19,6 +19,7 @@ if (is_a($VC, 'VC_svn')) { /* Spawn the file object. */ $fl = $VC->getFileObject($where, $cache); +$rev_ob = $VC->getRevisionObject(); Chora::checkError($fl); /* $trunk contains an array of trunk revisions. */ @@ -38,7 +39,7 @@ foreach ($fl->branches as $rev => $sym) { * 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) { @@ -48,7 +49,7 @@ foreach ($fl->logs as $log) { } /* 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); } } @@ -96,7 +97,7 @@ function populateGrid($row, $col) $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 @@ -182,7 +183,7 @@ foreach ($grid as $row) { /* 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]; @@ -191,13 +192,13 @@ foreach ($grid as $row) { } 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()); diff --git a/chora/templates/annotate/line.inc b/chora/templates/annotate/line.inc index 795a775b9..d6da97b9e 100644 --- a/chora/templates/annotate/line.inc +++ b/chora/templates/annotate/line.inc @@ -1,7 +1,7 @@ - -   + abbrev($rev) ?> + abbrev($prev) ?>  diff --git a/chora/templates/diff/hr/header.inc b/chora/templates/diff/hr/header.inc index 6e641000c..f64c6f8d8 100644 --- a/chora/templates/diff/hr/header.inc +++ b/chora/templates/diff/hr/header.inc @@ -45,7 +45,7 @@
  • - : + abbrev($val['rev']) ?>:
    @@ -53,8 +53,8 @@ - - + + diff --git a/chora/templates/directory/file.inc b/chora/templates/directory/file.inc index fb6728b32..3ab7c28dd 100644 --- a/chora/templates/directory/file.inc +++ b/chora/templates/directory/file.inc @@ -16,11 +16,11 @@ - + - + - +abbrev($head) ?> @@ -31,7 +31,7 @@ - + abbrev($head) ?> diff --git a/chora/templates/log/rev.inc b/chora/templates/log/rev.inc index f9c605a4e..3d013c057 100644 --- a/chora/templates/log/rev.inc +++ b/chora/templates/log/rev.inc @@ -5,7 +5,7 @@ " onclick="revlog_sdiff(this);"> - '; if ($branchName) echo ' ' . Horde::link(Chora::url('', $where, array('onb' => $branchRev))) . htmlspecialchars($branchName) . ''; if (!empty($lg->lines)) echo ' (' . sprintf('%s lines', $lg->lines) . ')'; ?> + abbrev($rev) . ''; if ($branchName) echo ' ' . Horde::link(Chora::url('', $where, array('onb' => $branchRev))) . htmlspecialchars($branchName) . ''; if (!empty($lg->lines)) echo ' (' . sprintf('%s lines', $lg->lines) . ')'; ?> diff --git a/framework/Vcs/lib/Horde/Vcs/Git.php b/framework/Vcs/lib/Horde/Vcs/Git.php index 3a3037905..961167b17 100644 --- a/framework/Vcs/lib/Horde/Vcs/Git.php +++ b/framework/Vcs/lib/Horde/Vcs/Git.php @@ -82,15 +82,12 @@ class Horde_Vcs_Annotate_git extends Horde_Vcs_Annotate 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 ); @@ -107,7 +104,10 @@ class Horde_Vcs_Annotate_git extends Horde_Vcs_Annotate 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; } } }