mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 21:10:56 +01:00
Display blame colors in multiline highlighting
Summary: Multiline highlighting didn't work well together with blame. Blame Rev: rPe24a6ac Test Plan: /diffusion/...$596-598?view=blame Reviewers: epriestley Reviewed By: epriestley CC: Koolvin, aran, epriestley Differential Revision: https://secure.phabricator.com/D1814
This commit is contained in:
parent
95eb3bcf09
commit
afe38572fe
1 changed files with 11 additions and 12 deletions
|
@ -299,25 +299,23 @@ class DiffusionBrowseFileController extends DiffusionController {
|
|||
private function buildDisplayRows($text_list, $rev_list, $blame_dict,
|
||||
$needs_blame, DiffusionRequest $drequest, $file_query, $selected) {
|
||||
$last_rev = null;
|
||||
$color = null;
|
||||
$color = '#eeeeee';
|
||||
$rows = array();
|
||||
$n = 1;
|
||||
$view = $this->getRequest()->getStr('view');
|
||||
|
||||
if ($blame_dict) {
|
||||
$epoch_list = ipull($blame_dict, 'epoch');
|
||||
$max = max($epoch_list);
|
||||
$min = min($epoch_list);
|
||||
$range = $max - $min + 1;
|
||||
} else {
|
||||
$range = 1;
|
||||
$epoch_max = max($epoch_list);
|
||||
$epoch_min = min($epoch_list);
|
||||
$epoch_range = $epoch_max - $epoch_min + 1;
|
||||
}
|
||||
|
||||
$targ = '';
|
||||
$min_line = 0;
|
||||
$line = $drequest->getLine();
|
||||
if (strpos($line,'-') !== false) {
|
||||
list($min,$max) = explode('-',$line,2);
|
||||
if (strpos($line, '-') !== false) {
|
||||
list($min, $max) = explode('-', $line, 2);
|
||||
$min_line = min($min, $max);
|
||||
$max_line = max($min, $max);
|
||||
} else if (strlen($line)) {
|
||||
|
@ -325,7 +323,6 @@ class DiffusionBrowseFileController extends DiffusionController {
|
|||
$max_line = $line;
|
||||
}
|
||||
|
||||
|
||||
foreach ($text_list as $k => $line) {
|
||||
if ($needs_blame) {
|
||||
// If the line's rev is same as the line above, show empty content
|
||||
|
@ -340,9 +337,11 @@ class DiffusionBrowseFileController extends DiffusionController {
|
|||
'<th style="background: '.$color.'"></th>';
|
||||
} else {
|
||||
|
||||
$color_number = (int)(0xEE -
|
||||
0xEE * ($blame_dict[$rev]['epoch'] - $min) / $range);
|
||||
$color = sprintf('#%02xee%02x', $color_number, $color_number);
|
||||
if ($blame_dict) {
|
||||
$color_number = (int)(0xEE -
|
||||
0xEE * ($blame_dict[$rev]['epoch'] - $epoch_min) / $epoch_range);
|
||||
$color = sprintf('#%02xee%02x', $color_number, $color_number);
|
||||
}
|
||||
|
||||
$revision_link = self::renderRevision(
|
||||
$drequest,
|
||||
|
|
Loading…
Reference in a new issue