summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4f7b34c)
raw | patch | inline | side by side (parent: 4f7b34c)
author | Luben Tuikov <ltuikov@yahoo.com> | |
Sun, 23 Jul 2006 20:37:53 +0000 (13:37 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 25 Jul 2006 01:21:52 +0000 (18:21 -0700) |
A revision block is the largest number of adjacent
lines of code originating from the same revision.
This patch adds color to git_blame2(), in that no two
adjacent revision blocks have the same color. The color
alternates between light and dark.
As we annotate the code lines, we alternate the color
(light, dark) of code lines _per revision_. This makes it
easier to see line conglomerations per revision.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
lines of code originating from the same revision.
This patch adds color to git_blame2(), in that no two
adjacent revision blocks have the same color. The color
alternates between light and dark.
As we annotate the code lines, we alternate the color
(light, dark) of code lines _per revision_. This makes it
easier to see line conglomerations per revision.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.cgi | patch | blob | history |
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2c2d9c8d8f8aa85ebc876edc481639ec5c75c803..16340f2106162bffa1849e75c8fcc980132d42d1 100755 (executable)
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
"</div>\n";
git_print_page_path($file_name, $ftype);
-
+ my @rev_color = (qw(light dark));
+ my $num_colors = scalar(@rev_color);
+ my $current_color = 0;
+ my $last_rev;
print "<div class=\"page_body\">\n";
-
print "<table class=\"blame\">\n";
print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n";
while (my $line = <$fd>) {
my $lineno = $blame_line{'lineno'};
my $data = $blame_line{'data'};
- print "<tr>\n";
+ if (!defined $last_rev) {
+ $last_rev = $full_rev;
+ } elsif ($last_rev ne $full_rev) {
+ $last_rev = $full_rev;
+ $current_color = ++$current_color % $num_colors;
+ }
+ print "<tr class=\"$rev_color[$current_color]\">\n";
print "<td class=\"sha1\">" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$full_rev;f=$file_name")}, esc_html($rev)) . "</td>\n";
print "<td class=\"linenr\"><a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" . esc_html($lineno) . "</a></td>\n";
}
print "</table>\n";
print "</div>";
-
close $fd or print "Reading blob failed\n";
git_footer_html();
}