From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.176.0/21 X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MSGID_FROM_MTA_HEADER,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 From: Jakub Narebski Subject: [PATCH 10/n] gitweb: New improved formatting of chunk header in diff Date: Wed, 1 Nov 2006 14:36:08 +0100 Message-ID: <200611011436.08715.jnareb@gmail.com> References: <200610301953.01875.jnareb@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit NNTP-Posting-Date: Wed, 1 Nov 2006 13:36:26 +0000 (UTC) Return-path: Envelope-to: gcvg-git@gmane.org DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=RsGq4wO43JVWHqybWnoHMjs4g29/EzwWgOgGtxM0fdMYI2oL7u0aUhjaC5bpWa0MGk+aYbNmKNpjqFqasJUg9ucfAcBjFhu+rAlkwOVPta7lCK9TIsn0Tktba9gyYUcxPUQbSGsxRUAK8Eb/9C3G96ZwZ0I2UgTjK+2ldFhYQQY= User-Agent: KMail/1.9.3 In-Reply-To: <200610301953.01875.jnareb@gmail.com> Content-Disposition: inline Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GfGGH-0005ha-1S for gcvg-git@gmane.org; Wed, 01 Nov 2006 14:36:09 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946712AbWKANgF (ORCPT ); Wed, 1 Nov 2006 08:36:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752212AbWKANgF (ORCPT ); Wed, 1 Nov 2006 08:36:05 -0500 Received: from ug-out-1314.google.com ([66.249.92.168]:62343 "EHLO ug-out-1314.google.com") by vger.kernel.org with ESMTP id S1752209AbWKANgD (ORCPT ); Wed, 1 Nov 2006 08:36:03 -0500 Received: by ug-out-1314.google.com with SMTP id 32so1707195ugm for ; Wed, 01 Nov 2006 05:36:01 -0800 (PST) Received: by 10.67.30.6 with SMTP id h6mr8132029ugj; Wed, 01 Nov 2006 05:35:57 -0800 (PST) Received: from host-81-190-18-116.torun.mm.pl ( [81.190.18.116]) by mx.google.com with ESMTP id x37sm559043ugc.2006.11.01.05.35.57; Wed, 01 Nov 2006 05:35:57 -0800 (PST) To: git@vger.kernel.org Sender: git-owner@vger.kernel.org If we have provided enough info, and diff is not combined diff, and if provided diff line is chunk header, then: * split chunk header into .chunk_info and .section span elements, first containing proper chunk header, second section heading (aka. which function), for separate styling: the proper chunk header is on non-white background, section heading part uses slightly lighter color. * hyperlink from-file-range to starting line of from-file, if file was not created. * hyperlink to-file-range to starting line of to-file, if file was not deleted. Links are of invisible variety (and "list" class). Signed-off-by: Jakub Narebski --- As usual, you can check out the new version of gitweb at work at my web page: http://roke_._dyndns_._info/cgi-bin/gitweb/gitweb.cgi The actual formatting is open for discussion. gitweb/gitweb.css | 13 +++++++++++++ gitweb/gitweb.perl | 18 +++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletions(-) diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css index 87dbc52..41c3084 100644 --- a/gitweb/gitweb.css +++ b/gitweb/gitweb.css @@ -327,11 +327,13 @@ div.diff.extended_header { padding: 2px 0px 2px 0px; } +div.diff a.list, div.diff a.path, div.diff a.hash { text-decoration: none; } +div.diff a.list:hover, div.diff a.path:hover, div.diff a.hash:hover { text-decoration: underline; @@ -355,14 +357,25 @@ div.diff.rem { color: #cc0000; } +div.diff.chunk_header a, div.diff.chunk_header { color: #990099; +} +div.diff.chunk_header { border: dotted #ffe0ff; border-width: 1px 0px 0px 0px; margin-top: 2px; } +div.diff.chunk_header span.chunk_info { + background-color: #ffeeff; +} + +div.diff.chunk_header span.section { + color: #aa22aa; +} + div.diff.incomplete { color: #cccccc; } diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index b8fcafc..a7739af 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -830,6 +830,7 @@ sub format_subject_html { sub format_diff_line { my $line = shift; + my ($from, $to) = @_; my $char = substr($line, 0, 1); my $diff_class = ""; @@ -845,6 +846,21 @@ sub format_diff_line { $diff_class = " incomplete"; } $line = untabify($line); + if ($from && $to && $line =~ m/^\@{2} /) { + my ($from_text, $from_start, $from_lines, $to_text, $to_start, $to_lines, $section) = + $line =~ m/^\@{2} (-(\d+),(\d+)) (\+(\d+),(\d+)) \@{2}(.*)$/; + if ($from->{'href'}) { + $from_text = $cgi->a({-href=>"$from->{'href'}#l$from_start", + -class=>"list"}, $from_text); + } + if ($to->{'href'}) { + $to_text = $cgi->a({-href=>"$to->{'href'}#l$to_start", + -class=>"list"}, $to_text); + } + $line = "@@ $from_text $to_text @@" . + "" . esc_html($section, -nbsp=>1) . ""; + return "
$line
\n"; + } return "
" . esc_html($line, -nbsp=>1) . "
\n"; } @@ -2205,7 +2221,7 @@ sub git_patchset_body { next LINE; } - print format_diff_line($patch_line); + print format_diff_line($patch_line, \%from, \%to); } print "\n" if $patch_found; # class="patch" -- 1.4.3.3