@matheusbsbs / matheus-bagliano / commits / eb51ec9c05
Fork 0

gitweb: Add history and blame to git_difftree_body()

Add blame and history to Deleted files. Add blame and history to Modified or Type changed files. Add blame and history to Renamed or Copied files. This allows us to do blame->commit->blame->commit->blame->... instead of blame->commit->file->blame->commit->file->blame->... which is longer and easier to get wrong. Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Luben Tuikov committed Sep 27, 2006 at 17:24 UTC eb51ec9c05e6f4b29567f58102e33c453e1a9a57
1 file changed +23 -12
gitweb/gitweb.perl
+23 -12
@@ -1761,9 +1761,12 @@ sub git_difftree_body {
1761 print $cgi->a({-href => "#patch$patchno"}, "patch");
1762 print " | ";
1763 }
1764 + print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
1765 + file_name=>$diff{'file'})},
1766 + "blame") . " | ";
1767 print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
1765 - file_name=>$diff{'file'})},
1766 - "history");
1768 + file_name=>$diff{'file'})},
1769 + "history");
1770 print "</td>\n";
1771
1772 } elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed
@@ -1803,8 +1806,11 @@ sub git_difftree_body {
1806 }
1807 print " | ";
1808 }
1806 - print $cgi->a({-href => href(action=>"history",
1807 - hash_base=>$hash, file_name=>$diff{'file'})},
1809 + print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
1810 + file_name=>$diff{'file'})},
1811 + "blame") . " | ";
1812 + print $cgi->a({-href => href(action=>"history", hash_base=>$hash,
1813 + file_name=>$diff{'file'})},
1814 "history");
1815 print "</td>\n";
1816
@@ -1830,17 +1836,22 @@ sub git_difftree_body {
1836 if ($action eq 'commitdiff') {
1837 # link to patch
1838 $patchno++;
1833 - print " | " .
1834 - $cgi->a({-href => "#patch$patchno"}, "patch");
1839 + print $cgi->a({-href => "#patch$patchno"}, "patch");
1840 } else {
1836 - print " | " .
1837 - $cgi->a({-href => href(action=>"blobdiff",
1838 - hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
1839 - hash_base=>$hash, hash_parent_base=>$parent,
1840 - file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
1841 - "diff");
1841 + print $cgi->a({-href => href(action=>"blobdiff",
1842 + hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
1843 + hash_base=>$hash, hash_parent_base=>$parent,
1844 + file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
1845 + "diff");
1846 }
1847 + print " | ";
1848 }
1849 + print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
1850 + file_name=>$diff{'from_file'})},
1851 + "blame") . " | ";
1852 + print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
1853 + file_name=>$diff{'from_file'})},
1854 + "history");
1855 print "</td>\n";
1856
1857 } # we should not encounter Unmerged (U) or Unknown (X) status