2012-04-06 00:00:15 +02:00
|
|
|
- if @suppress_diff
|
|
|
|
.alert-message.block-message
|
2012-06-04 00:37:27 +02:00
|
|
|
%p
|
2012-10-25 11:16:14 +02:00
|
|
|
%strong Warning! Large commit with more then #{Commit::DIFF_SAFE_SIZE} files changed.
|
2012-04-06 00:00:15 +02:00
|
|
|
%p To prevent performance issue we rejected diff information.
|
2012-06-04 00:37:27 +02:00
|
|
|
%p
|
|
|
|
But if you still want to see diff
|
2012-10-25 11:16:14 +02:00
|
|
|
= link_to "click this link", project_commit_path(@project, @commit, force_show_diff: true), class: "underlined_link"
|
2012-04-06 00:00:15 +02:00
|
|
|
|
|
|
|
%p.cgray
|
|
|
|
Showing #{pluralize(diffs.count, "changed file")}
|
2012-11-18 17:41:41 +01:00
|
|
|
.file-stats
|
2012-08-11 00:07:50 +02:00
|
|
|
= render "commits/diff_head", diffs: diffs
|
2012-04-06 00:00:15 +02:00
|
|
|
|
|
|
|
- unless @suppress_diff
|
|
|
|
- diffs.each_with_index do |diff, i|
|
|
|
|
- next if diff.diff.empty?
|
2012-04-11 22:03:56 +02:00
|
|
|
- file = (@commit.tree / diff.new_path)
|
|
|
|
- file = (@commit.prev_commit.tree / diff.old_path) unless file
|
2012-04-06 00:00:15 +02:00
|
|
|
- next unless file
|
2012-11-18 17:41:41 +01:00
|
|
|
.diff_file{id: "diff-#{i}"}
|
2012-04-06 00:00:15 +02:00
|
|
|
.diff_file_header
|
|
|
|
- if diff.deleted_file
|
2012-11-18 17:41:41 +01:00
|
|
|
%span= diff.old_path
|
|
|
|
|
|
|
|
- if @commit.prev_commit
|
|
|
|
= link_to project_tree_path(@project, tree_join(@commit.prev_commit_id, diff.new_path)), {:class => 'btn right view-commit'} do
|
|
|
|
View file @
|
|
|
|
%span.commit-short-id= @commit.short_id(6)
|
2012-04-06 00:00:15 +02:00
|
|
|
- else
|
2012-11-18 17:41:41 +01:00
|
|
|
%span= diff.new_path
|
|
|
|
- if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
|
|
|
|
%span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
|
|
|
|
|
|
|
|
= link_to project_tree_path(@project, tree_join(@commit.id, diff.new_path)), {:class => 'btn right view-commit'} do
|
|
|
|
View file @
|
|
|
|
%span.commit-short-id= @commit.short_id(6)
|
|
|
|
|
2012-04-06 00:00:15 +02:00
|
|
|
%br/
|
|
|
|
.diff_file_content
|
2012-07-05 08:35:23 +02:00
|
|
|
-# Skipp all non non-supported blobs
|
|
|
|
- next unless file.respond_to?('text?')
|
2012-04-06 00:00:15 +02:00
|
|
|
- if file.text?
|
2012-08-11 00:07:50 +02:00
|
|
|
= render "commits/text_file", diff: diff, index: i
|
2012-04-06 00:00:15 +02:00
|
|
|
- elsif file.image?
|
2012-11-18 17:41:41 +01:00
|
|
|
- old_file = (@commit.prev_commit.tree / diff.old_path)
|
2012-10-25 11:16:14 +02:00
|
|
|
- if diff.renamed_file || diff.new_file || diff.deleted_file
|
2012-07-05 22:19:37 +02:00
|
|
|
.diff_file_content_image
|
2012-11-18 17:41:41 +01:00
|
|
|
.image{class: image_diff_class(diff)}
|
|
|
|
%img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
|
|
|
|
%div.image-info= "#{number_to_human_size file.size}"
|
2012-10-25 11:16:14 +02:00
|
|
|
- else
|
2012-07-05 22:19:37 +02:00
|
|
|
.diff_file_content_image.img_compared
|
2012-11-18 17:41:41 +01:00
|
|
|
.image.diff_removed
|
|
|
|
%img{src: "data:#{file.mime_type};base64,#{Base64.encode64(old_file.data)}"}
|
|
|
|
%div.image-info= "#{number_to_human_size file.size}"
|
|
|
|
.image.diff_added
|
|
|
|
%img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
|
|
|
|
%div.image-info= "#{number_to_human_size file.size}"
|
2012-04-06 00:00:15 +02:00
|
|
|
- else
|
2012-06-29 20:55:22 +02:00
|
|
|
%p.nothing_here_message No preview for this file type
|