<% my $user_id = stash('user'); my $project_id = stash('project'); my $rev = stash('rev'); my $from_rev = stash('from_rev'); my $git = app->git; my $diff_tree = stash('diff_tree'); my $blob_diff = stash('blob_diff'); my $from_mode_str = $diff_tree->{from_mode_str}; my $to_mode_str = $diff_tree->{to_mode_str}; my $lines = $blob_diff->{lines} || []; my $file = $blob_diff->{file}; $file = '' unless defined $file; my $from_file = $blob_diff->{from_file}; $from_file = $file unless defined $from_file; my $status = $diff_tree->{status} || ''; my $binary_rev_shown; my $binary_from_rev_shown; my $binary_not_shown; if ($blob_diff->{binary}) { if ($status eq 'A') { if ($git->blob_is_image(app->rep_info($user_id, $project_id), $rev, $file)) { $binary_rev_shown = 1; } else { $binary_not_shown = 1; } } elsif ($status eq 'D') { if ($git->blob_is_image(app->rep_info($user_id, $project_id), $from_rev, $file)) { $binary_from_rev_shown = 1; } else { $binary_not_shown = 1; } } else { if ($git->blob_is_image(app->rep_info($user_id, $project_id), $from_rev, $file) && $git->blob_is_image(app->rep_info($user_id, $project_id), $from_rev, $file)) { $binary_from_rev_shown = 1; $binary_rev_shown = 1; } else { $binary_not_shown = 1; } } } %>
%= include '/include/diff_status_bar', diff_tree => $diff_tree; % if ($status eq 'R' || $status eq 'C') { <%= $from_file %> → <%= $file %> % } else { <%= $file %> % } % if ($status ne 'A' && $status ne 'D' && $from_mode_str ne $to_mode_str) { <%= "100$from_mode_str → 100$to_mode_str" %> % }
% if ($status eq 'D') { "> View % } else { "> View % }
<% my $not_shown; my $from_rev_shown; my $rev_shown; %> % if ($blob_diff->{binary}) { % if ($binary_not_shown) {
Binary file not shown.
% } else { % } % } elsif (@$lines) { % for my $line (@$lines) { % my $class = $line->{class}; % my $value = $line->{value}; <% my $bk_color_line = ''; my $bk_color = ''; my $border_color; if ($value =~ /^@/) { $bk_color_line = '#f3f3ff'; $border_color = '#e4e4ff'; $bk_color = '#f8f8ff'; } elsif ($value =~ /^\+/) { $bk_color_line = '#ceffce'; $border_color = '#b4e2b4'; $bk_color = '#dfd'; } elsif ($value =~ /^-/) { $bk_color_line = '#f7c8c8'; $border_color = '#e9aeae'; $bk_color = '#fdd'; } else { $border_color = '#e5e5e5'; } %> % }
<%= $line->{before_line_num} %> <%= $line->{after_line_num} %>
<%= $value %>
% } else {
% if ($status eq 'R') { File renamed without changes. % } elsif ($status eq 'A' || $status eq 'D') { No changes. % } elsif ($from_mode_str ne $to_mode_str) { File mode changed. % }
% }