mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 17:02:41 +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,
|
private function buildDisplayRows($text_list, $rev_list, $blame_dict,
|
||||||
$needs_blame, DiffusionRequest $drequest, $file_query, $selected) {
|
$needs_blame, DiffusionRequest $drequest, $file_query, $selected) {
|
||||||
$last_rev = null;
|
$last_rev = null;
|
||||||
$color = null;
|
$color = '#eeeeee';
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$n = 1;
|
$n = 1;
|
||||||
$view = $this->getRequest()->getStr('view');
|
$view = $this->getRequest()->getStr('view');
|
||||||
|
|
||||||
if ($blame_dict) {
|
if ($blame_dict) {
|
||||||
$epoch_list = ipull($blame_dict, 'epoch');
|
$epoch_list = ipull($blame_dict, 'epoch');
|
||||||
$max = max($epoch_list);
|
$epoch_max = max($epoch_list);
|
||||||
$min = min($epoch_list);
|
$epoch_min = min($epoch_list);
|
||||||
$range = $max - $min + 1;
|
$epoch_range = $epoch_max - $epoch_min + 1;
|
||||||
} else {
|
|
||||||
$range = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$targ = '';
|
$targ = '';
|
||||||
$min_line = 0;
|
$min_line = 0;
|
||||||
$line = $drequest->getLine();
|
$line = $drequest->getLine();
|
||||||
if (strpos($line,'-') !== false) {
|
if (strpos($line, '-') !== false) {
|
||||||
list($min,$max) = explode('-',$line,2);
|
list($min, $max) = explode('-', $line, 2);
|
||||||
$min_line = min($min, $max);
|
$min_line = min($min, $max);
|
||||||
$max_line = max($min, $max);
|
$max_line = max($min, $max);
|
||||||
} else if (strlen($line)) {
|
} else if (strlen($line)) {
|
||||||
|
@ -325,7 +323,6 @@ class DiffusionBrowseFileController extends DiffusionController {
|
||||||
$max_line = $line;
|
$max_line = $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ($text_list as $k => $line) {
|
foreach ($text_list as $k => $line) {
|
||||||
if ($needs_blame) {
|
if ($needs_blame) {
|
||||||
// If the line's rev is same as the line above, show empty content
|
// 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>';
|
'<th style="background: '.$color.'"></th>';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if ($blame_dict) {
|
||||||
$color_number = (int)(0xEE -
|
$color_number = (int)(0xEE -
|
||||||
0xEE * ($blame_dict[$rev]['epoch'] - $min) / $range);
|
0xEE * ($blame_dict[$rev]['epoch'] - $epoch_min) / $epoch_range);
|
||||||
$color = sprintf('#%02xee%02x', $color_number, $color_number);
|
$color = sprintf('#%02xee%02x', $color_number, $color_number);
|
||||||
|
}
|
||||||
|
|
||||||
$revision_link = self::renderRevision(
|
$revision_link = self::renderRevision(
|
||||||
$drequest,
|
$drequest,
|
||||||
|
|
Loading…
Reference in a new issue