git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Petr Baudis <pasky@suse.cz>, Fredrik Kuivinen <frekui@gmail.com>,
	Giuseppe Bilotta <giuseppe.bilotta@gmail.com>,
	Luben Tuikov <ltuikov@yahoo.com>,
	Martin Koegler <mkoegler@auto.tuwien.ac.at>,
	Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH 04/10] gitweb: Mark commits with no "previous" in 'blame' view
Date: Sat, 25 Jul 2009 00:44:04 +0200	[thread overview]
Message-ID: <1248475450-5668-5-git-send-email-jnareb@gmail.com> (raw)
In-Reply-To: <1248475450-5668-1-git-send-email-jnareb@gmail.com>

Use "no-previous" class to mark blamed commits which do not have
"previous" header.  Those are commits in which blamed file was created
(added); this includes boundary commits.  This means that 'linenr'
link leads to blamed commit, not (one of) parent of blamed commit.
Therefore currently line number for such commit uses bold weight font
to denote this situation; the effect is subtle.

Use "multiple-previous" class in the opposite situation, where blamed
commit has multiple "previous" headers (is an evil merge).  Currently
this class is not used for styling.  In this situation 'linenr' link
leads to first of "previous" commits (first parent).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is new commit, which didn't appear in v1 of this series.

It does what marking "boundary" commit meant to do: it marks (via
admittedly quite subtle change of style) "linenr" links which lead to
'blame' view at blamed commit, not at parent commit (because there is
no parent commit).

This patch is after one using "previous" header for finding parents
for "linenr" links, because it also uses (still undocumented)
"previous" header.

 gitweb/gitweb.css  |    3 ++-
 gitweb/gitweb.perl |    7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index f47709b..4763337 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -242,7 +242,8 @@ tr.dark:hover {
 	background-color: #edece6;
 }
 
-tr.boundary td.sha1 {
+tr.boundary td.sha1,
+tr.no-previous td.linenr {
 	font-weight: bold;
 }
 
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b8a121b..128bddd 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4819,7 +4819,7 @@ HTML
 		my ($full_rev, $orig_lineno, $lineno, $group_size) =
 		   ($line =~ /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/);
 		if (!exists $metainfo{$full_rev}) {
-			$metainfo{$full_rev} = {};
+			$metainfo{$full_rev} = { 'nprevious' => 0 };
 		}
 		my $meta = $metainfo{$full_rev};
 		my $data;
@@ -4829,6 +4829,9 @@ HTML
 			if ($data =~ /^(\S+)(?: (.*))?$/) {
 				$meta->{$1} = $2 unless exists $meta->{$1};
 			}
+			if ($data =~ /^previous /) {
+				$meta->{'nprevious'}++;
+			}
 		}
 		my $short_rev = substr($full_rev, 0, 8);
 		my $author = $meta->{'author'};
@@ -4840,6 +4843,8 @@ HTML
 		}
 		my $tr_class = $rev_color[$current_color];
 		$tr_class .= ' boundary' if (exists $meta->{'boundary'});
+		$tr_class .= ' no-previous' if ($meta->{'nprevious'} == 0);
+		$tr_class .= ' multiple-previous' if ($meta->{'nprevious'} > 1);
 		print "<tr id=\"l$lineno\" class=\"$tr_class\">\n";
 		if ($group_size) {
 			print "<td class=\"sha1\"";
-- 
1.6.3.3

  parent reply	other threads:[~2009-07-24 22:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24 22:44 [PATCHv2 00/10] gitweb: 'blame' view improvements Jakub Narebski
2009-07-24 22:44 ` [PATCH 01/10] gitweb: Make .error style generic Jakub Narebski
2009-07-24 22:44 ` [PATCH 02/10] gitweb: Mark boundary commits in 'blame' view Jakub Narebski
2009-07-25  0:13   ` Junio C Hamano
2009-07-25  0:32     ` Jakub Narebski
2009-07-25  0:39       ` Junio C Hamano
2009-07-24 22:44 ` [PATCHv2 03/10] gitweb: Use "previous" header of git-blame -p " Jakub Narebski
2009-07-24 22:44 ` Jakub Narebski [this message]
2009-07-24 22:44 ` [PATCHv2 05/10] gitweb: Add author initials in 'blame' view, a la "git gui blame" Jakub Narebski
2009-07-24 22:44 ` [PATCH/RFC 06/10] gitweb: Use light/dark for class names also in 'blame' view Jakub Narebski
2009-07-24 22:44 ` [PATCH 07/10] gitweb: Add -partial_query option to href() subroutine Jakub Narebski
2009-07-24 22:44 ` [PATCH 08/10] gitweb: Add optional "time to generate page" info in footer Jakub Narebski
2009-07-24 22:44 ` [PATCHv2/RFC 09/10] gitweb: Incremental blame (proof of concept) Jakub Narebski
2009-07-25 19:28   ` Jakub Narebski
2009-07-24 22:44 ` [PATCH/RFC 10/10] gitweb: Create links leading to 'blame_incremental' using JavaScript Jakub Narebski
2009-07-25 10:46   ` Martin Koegler
2009-07-26 10:06     ` Jakub Narebski
2009-07-27 18:10       ` Martin Koegler
2009-07-27 19:06         ` Jakub Narebski
2009-07-24 23:47 ` [PATCHv2 00/10] gitweb: 'blame' view improvements Junio C Hamano
2009-07-25  0:10   ` Jakub Narebski

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=1248475450-5668-5-git-send-email-jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=frekui@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=giuseppe.bilotta@gmail.com \
    --cc=ltuikov@yahoo.com \
    --cc=mkoegler@auto.tuwien.ac.at \
    --cc=pasky@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).