add diff status bar to commi...
|
1 |
<% |
2 |
# Parameters |
|
fix compare page from forke...
|
3 |
my $rep_info = stash('rep_info') // app->rep_info($user, $project); |
cleanup
|
4 |
my $rev = stash('rev'); |
5 |
my $from_rev = stash('from_rev'); |
|
add --ignore-space-change fe...
|
6 | |
7 |
my $param_ignore_space_change = param('w'); |
|
remove [basic]show_ignore_sp...
|
8 |
my $ignore_space_change; |
9 |
if ($param_ignore_space_change) { |
|
10 |
$ignore_space_change = 1; |
|
11 |
} |
|
12 |
else { |
|
13 |
$ignore_space_change = app->dbi->model('project')->select( |
|
14 |
'ignore_space_change', |
|
15 |
where => {user_id => $user, name => $project} |
|
16 |
)->value; |
|
17 |
} |
|
add diff status bar to commi...
|
18 |
|
19 |
# Git |
|
revert encoding support
|
20 |
my $git = app->git; |
add diff status bar to commi...
|
21 |
|
22 |
# Diff tree |
|
23 |
my $diff_trees = $git->diff_tree( |
|
fix compare page from forke...
|
24 |
$rep_info, |
cleanup
|
25 |
$rev, |
26 |
$from_rev, |
|
add --ignore-space-change fe...
|
27 |
{ignore_space_change => $ignore_space_change} |
add diff status bar to commi...
|
28 |
); |
improve rename commit
|
29 | |
add diff status bar to commi...
|
30 |
my $diff_trees_h = {}; |
31 |
for my $diff_tree (@$diff_trees) { |
|
improve rename commit
|
32 |
my $file = $diff_tree->{to_file}; |
33 |
$file = $diff_tree->{from_file} unless defined $file; |
|
add diff status bar to commi...
|
34 |
$diff_trees_h->{$file} = $diff_tree if defined $file; |
35 |
} |
|
36 |
|
|
37 |
# Get blob diffs |
|
add --ignore-space-change fe...
|
38 |
my $blob_diffs = $git->blob_diffs( |
fix compare page from forke...
|
39 |
$rep_info, |
cleanup rep_info
|
40 |
$from_rev, |
41 |
$rev, |
|
42 |
$diff_trees, |
|
43 |
{ignore_space_change => $ignore_space_change} |
|
add --ignore-space-change fe...
|
44 |
) || []; |
45 |
|
|
add diff status bar to commi...
|
46 |
my $blob_diffs_h = {}; |
add total add and delete lin...
|
47 |
my $total_add_line_count = 0; |
48 |
my $total_delete_line_count = 0; |
|
add diff status bar to commi...
|
49 |
for my $blob_diff (@$blob_diffs) { |
50 |
my $file = $blob_diff->{file}; |
|
51 |
$blob_diffs_h->{$file} = $blob_diff; |
|
add total add and delete lin...
|
52 |
$total_add_line_count += $blob_diff->{add_line_count}; |
53 |
$total_delete_line_count += $blob_diff->{delete_line_count}; |
|
add diff status bar to commi...
|
54 |
} |
55 |
%> |
|
56 | ||
57 |
%= javascript begin |
|
58 |
$(document).ready(function () { |
|
59 |
|
|
60 |
// Diff Stats Button |
|
61 |
var diff_tree_show = false; |
|
62 |
var original_diff_stats_btn_text = $('#diff-stats-btn').text(); |
|
63 |
|
|
64 |
$('#diff-stats-btn').on('click', function () { |
|
65 |
if (diff_tree_show) { |
|
66 |
$(this).text(original_diff_stats_btn_text); |
|
67 |
$('#diff_tree').css('display', 'none'); |
|
68 |
} |
|
69 |
else { |
|
70 |
$('#diff_tree').css('display', 'block'); |
|
71 |
} |
|
72 |
diff_tree_show = !diff_tree_show; |
|
73 |
}); |
|
74 |
}); |
|
75 |
% end |
|
76 | ||
improve commit page design
|
77 |
<div class="commit-changes"> |
78 |
<div> |
|
79 |
Showing <b><a id="diff-stats-btn" href="javascript:void;"><%= @$diff_trees %> changed files</a></b> |
|
improve first commit
|
80 |
with |
81 |
<b><%= $total_add_line_count %> additions</b> |
|
82 |
and |
|
83 |
<b><%= $total_delete_line_count %> deletions</b> |
|
add diff status bar to commi...
|
84 |
</div> |
85 |
</div> |
|
improve commit page design
|
86 | |
87 |
<div id="diff_tree" style="display:none"> |
|
cleanup
|
88 |
<%= include '/include/diff_tree', id => $rev, from_id => $from_rev, |
impved merge commit logic
|
89 |
diff_trees => $diff_trees %> |
add diff status bar to commi...
|
90 |
</div> |
improve commit page design
|
91 | |
add diff status bar to commi...
|
92 |
% my $num = 0; |
93 |
% for my $file (sort keys %$diff_trees_h) { |
|
94 |
<div id="diff-<%= $num %>"> |
|
95 |
% my $blob_diff = $blob_diffs_h->{$file}; |
|
improve first commit
|
96 |
%= include '/include/blob_diff_body', blob_diff => $blob_diff, diff_tree => $diff_trees_h->{$file}; |
add diff status bar to commi...
|
97 |
</div> |
98 |
% $num++; |
|
99 |
% } |
|
100 |
</div> |