From: Luben Tuikov <ltuikov@yahoo.com>
To: git@vger.kernel.org
Subject: [PATCH 3/3] gitweb.cgi: git_blame2: Revision blocks now have alternating colors
Date: Sun, 23 Jul 2006 13:37:53 -0700 (PDT) [thread overview]
Message-ID: <20060723203753.60963.qmail@web31814.mail.mud.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 556 bytes --]
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>
---
gitweb/gitweb.cgi | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 963471848-p3.patch --]
[-- Type: text/inline; name="p3.patch", Size: 1471 bytes --]
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2c2d9c8..16340f2 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1295,9 +1295,11 @@ sub git_blame2 {
$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>) {
@@ -1307,7 +1309,13 @@ sub git_blame2 {
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";
@@ -1316,8 +1324,6 @@ sub git_blame2 {
}
print "</table>\n";
print "</div>";
-
close $fd or print "Reading blob failed\n";
git_footer_html();
}
--
1.4.2.rc1.g9b54
reply other threads:[~2006-07-23 20:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060723203753.60963.qmail@web31814.mail.mud.yahoo.com \
--to=ltuikov@yahoo.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox