summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cb849b4)
raw | patch | inline | side by side (parent: cb849b4)
author | Jakub Narebski <jnareb@gmail.com> | |
Wed, 30 Aug 2006 22:35:07 +0000 (00:35 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 31 Aug 2006 19:58:07 +0000 (12:58 -0700) |
This is preparation for "tree blame" (similar to what ViewVC shows)
output, i.e. for each entry give commit where it was changed.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
output, i.e. for each entry give commit where it was changed.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 758032af64a0ce5a54b87dec449e8b1ed7d65dc6..7f6bdaa951114e6fd1e07b9768a43f4eab229c61 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
-remove_title => $remove_title);
}
+# print tree entry (row of git_tree), but without encompassing <tr> element
+sub git_print_tree_entry {
+ my ($t, $basedir, $hash_base, $have_blame) = @_;
+
+ my %base_key = ();
+ $base_key{hash_base} = $hash_base if defined $hash_base;
+
+ print "<td class=\"mode\">" . mode_str($t->{'mode'}) . "</td>\n";
+ if ($t->{'type'} eq "blob") {
+ print "<td class=\"list\">" .
+ $cgi->a({-href => href(action=>"blob", hash=>$t->{'hash'},
+ file_name=>"$basedir$t->{'name'}", %base_key),
+ -class => "list"}, esc_html($t->{'name'})) .
+ "</td>\n" .
+ "<td class=\"link\">" .
+ $cgi->a({-href => href(action=>"blob", hash=>$t->{'hash'},
+ file_name=>"$basedir$t->{'name'}", %base_key)},
+ "blob");
+ if ($have_blame) {
+ print " | " .
+ $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
+ file_name=>"$basedir$t->{'name'}", %base_key)},
+ "blame");
+ }
+ if (defined $hash_base) {
+ print " | " .
+ $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
+ hash=>$t->{'hash'}, file_name=>"$basedir$t->{'name'}")},
+ "history");
+ }
+ print " | " .
+ $cgi->a({-href => href(action=>"blob_plain",
+ hash=>$t->{'hash'}, file_name=>"$basedir$t->{'name'}")},
+ "raw") .
+ "</td>\n";
+
+ } elsif ($t->{'type'} eq "tree") {
+ print "<td class=\"list\">" .
+ $cgi->a({-href => href(action=>"tree", hash=>$t->{'hash'},
+ file_name=>"$basedir$t->{'name'}", %base_key)},
+ esc_html($t->{'name'})) .
+ "</td>\n" .
+ "<td class=\"link\">" .
+ $cgi->a({-href => href(action=>"tree", hash=>$t->{'hash'},
+ file_name=>"$basedir$t->{'name'}", %base_key)},
+ "tree");
+ if (defined $hash_base) {
+ print " | " .
+ $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
+ file_name=>"$basedir$t->{'name'}")},
+ "history");
+ }
+ print "</td>\n";
+ }
+}
+
## ......................................................................
## functions printing large fragments of HTML
my $refs = git_get_references();
my $ref = format_ref_marker($refs, $hash_base);
git_header_html();
- my %base_key = ();
my $base = "";
my $have_blame = gitweb_check_feature('blame');
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
- $base_key{hash_base} = $hash_base;
git_print_page_nav('tree','', $hash_base);
git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash_base);
} else {
+ undef $hash_base;
print "<div class=\"page_nav\">\n";
print "<br/><br/></div>\n";
print "<div class=\"title\">$hash</div>\n";
}
$alternate ^= 1;
- print "<td class=\"mode\">" . mode_str($t{'mode'}) . "</td>\n";
- if ($t{'type'} eq "blob") {
- print "<td class=\"list\">" .
- $cgi->a({-href => href(action=>"blob", hash=>$t{'hash'},
- file_name=>"$base$t{'name'}", %base_key),
- -class => "list"}, esc_html($t{'name'})) .
- "</td>\n" .
- "<td class=\"link\">" .
- $cgi->a({-href => href(action=>"blob", hash=>$t{'hash'},
- file_name=>"$base$t{'name'}", %base_key)},
- "blob");
- if ($have_blame) {
- print " | " .
- $cgi->a({-href => href(action=>"blame", hash=>$t{'hash'},
- file_name=>"$base$t{'name'}", %base_key)},
- "blame");
- }
- print " | " .
- $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
- hash=>$t{'hash'}, file_name=>"$base$t{'name'}")},
- "history") .
- " | " .
- $cgi->a({-href => href(action=>"blob_plain",
- hash=>$t{'hash'}, file_name=>"$base$t{'name'}")},
- "raw") .
- "</td>\n";
- } elsif ($t{'type'} eq "tree") {
- print "<td class=\"list\">" .
- $cgi->a({-href => href(action=>"tree", hash=>$t{'hash'},
- file_name=>"$base$t{'name'}", %base_key)},
- esc_html($t{'name'})) .
- "</td>\n" .
- "<td class=\"link\">" .
- $cgi->a({-href => href(action=>"tree", hash=>$t{'hash'},
- file_name=>"$base$t{'name'}", %base_key)},
- "tree") .
- " | " .
- $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
- file_name=>"$base$t{'name'}")},
- "history") .
- "</td>\n";
- }
+ git_print_tree_entry(\%t, $base, $hash_base, $have_blame);
+
print "</tr>\n";
}
print "</table>\n" .