rosa-build/app/views/projects/git/commits/diff.html.haml

31 lines
1.4 KiB
Plaintext
Raw Normal View History

2012-12-03 16:52:11 +00:00
-title = "#{t('diff')} #{shortest_hash_id @commit1.id}...#{shortest_hash_id @commit.id}"
2012-12-03 11:11:55 +00:00
-set_meta_tags :title => [title_object(@project), title]
=render 'submenu'
%h3=title
.both
#repo-wrapper
.leftside
-total_additions = @stats.inject(0) {|sum, n| sum + n.additions}
-total_deletions = @stats.inject(0) {|sum, n| sum + n.deletions}
%h5= t("layout.projects.diff_show_header",
:files => t("layout.projects.commit_files_count", :count => @stats.count),
:additions => t("layout.projects.commit_additions_count", :count => total_additions),
:deletions => t("layout.projects.commit_deletions_count", :count => total_deletions))
.both
-begin
=render_diff_stats @stats
-@project.repo.diff(@commit1.id, @commit.id).each_with_index do |commit_diff, diff_counter|
- commit_id = commit_diff.deleted_file ? @common_ancestor.id : @commit.id
.file
%a{:name => "diff-#{diff_counter}"}
.top
.l= h(commit_diff.a_path.rtruncate 120)
- if commit_diff.b_path.present?
.r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@project, commit_id, commit_diff.b_path)
.clear
-if commit_diff.diff.present? && !(@project.repo.tree(commit_id) / commit_diff.b_path).binary?
.diff_data=render_diff(commit_diff, :diff_counter => diff_counter)
- rescue Grit::Git::GitTimeout
%p= t 'layout.git.repositories.commit_diff_too_big'