... | ... |
@@ -839,7 +839,7 @@ sub parse_blobdiff_lines { |
839 | 839 |
my $before_line_num; |
840 | 840 |
my $after_line_num; |
841 | 841 |
|
842 |
- if ($line =~ /^\@\@\s-(\d+),\d+\s\+(\d+),\d+/) { |
|
842 |
+ if ($line =~ /^@@\s-(\d+),\d+\s\+(\d+),\d+/) { |
|
843 | 843 |
$next_before_line_num = $1; |
844 | 844 |
$next_after_line_num = $2; |
845 | 845 |
|
... | ... |
@@ -848,21 +848,22 @@ sub parse_blobdiff_lines { |
848 | 848 |
|
849 | 849 |
$class = 'chunk_header'; |
850 | 850 |
} |
851 |
- elsif ($line =~ /^\- /) { |
|
851 |
+ elsif ($line =~ /^\+\+\+/ || $line =~ /^---/) { next } |
|
852 |
+ elsif ($line =~ /^\-/) { |
|
852 | 853 |
$class = 'from_file'; |
853 |
- $before_line_num = $next_before_line_num--; |
|
854 |
+ $before_line_num = $next_before_line_num++; |
|
854 | 855 |
$after_line_num = ''; |
855 | 856 |
} |
856 |
- elsif ($line =~ /^\+ /) { |
|
857 |
+ elsif ($line =~ /^\+/) { |
|
857 | 858 |
$class = 'to_file'; |
858 | 859 |
$before_line_num = ''; |
859 |
- $after_line_num = $next_after_line_num--; |
|
860 |
+ $after_line_num = $next_after_line_num++; |
|
860 | 861 |
} |
861 | 862 |
elsif ($line =~ /^Binary files/) { $class = 'binary_file' } |
862 | 863 |
elsif ($line =~ /^ /) { |
863 | 864 |
$class = 'diff'; |
864 |
- $before_line_num = $next_before_line_num--; |
|
865 |
- $after_line_num = $next_after_line_num--; |
|
865 |
+ $before_line_num = $next_before_line_num++; |
|
866 |
+ $after_line_num = $next_after_line_num++; |
|
866 | 867 |
} |
867 | 868 |
else { next } |
868 | 869 |
|
... | ... |
@@ -1,41 +1,62 @@ |
1 | 1 |
<div class="border-gray" style="margin-bottom:20px;"> |
2 |
- <div class="border-bottom-gray padding5 bk-gray-light"> |
|
3 |
- <div class="row"> |
|
4 |
- <div class="span8" style="padding-top:6px"> |
|
5 |
- <%= $file %> |
|
6 |
- </div> |
|
7 |
- <div class="span3 offset1-mini text-right"> |
|
8 |
- <a class="btn" href="<%= url_for("/$user/$project/blob/$id/$file") %>"> |
|
9 |
- View file @ <%= substr($id, 0, 7) %> |
|
10 |
- </a> |
|
11 |
- </div> |
|
2 |
+ <div class="border-bottom-gray padding5 bk-gray-light"> |
|
3 |
+ <div class="row"> |
|
4 |
+ <div class="span8" style="padding-top:6px"> |
|
5 |
+ <%= $file %> |
|
6 |
+ </div> |
|
7 |
+ <div class="span3 offset1-mini text-right"> |
|
8 |
+ <a class="btn" href="<%= url_for("/$user/$project/blob/$id/$file") %>"> |
|
9 |
+ View file @ <%= substr($id, 0, 7) %> |
|
10 |
+ </a> |
|
12 | 11 |
</div> |
13 | 12 |
</div> |
14 |
- % for my $line (@$lines) { |
|
15 |
- % my $class = $line->{class}; |
|
16 |
- % my $value = $line->{value}; |
|
17 |
- % my $status = stash('status') || ''; |
|
18 |
- % if ($class eq 'binary_file') { |
|
19 |
- Binary files |
|
20 |
- <a href="<%= url_for("/$user/$project/blob/$from_id/$file") %>">a/<%= $file %></a> |
|
21 |
- and |
|
22 |
- <a href="<%= url_for("/$user/$project/blob/$id/$file") %>">b/<%= $file %></a> |
|
23 |
- differ |
|
24 |
- % } else { |
|
25 |
- % my $bk_color; |
|
26 |
- % if ($value =~ /^@@ /) { |
|
27 |
- % $bk_color = '#eef'; |
|
28 |
- % } elsif ($value =~ /^\+/) { |
|
29 |
- % $bk_color = '#ddffdd'; |
|
30 |
- % } elsif ($value =~ /^-/) { |
|
31 |
- % $bk_color = '#ffdddd'; |
|
13 |
+ </div> |
|
14 |
+ <table> |
|
15 |
+ % for my $line (@$lines) { |
|
16 |
+ % my $class = $line->{class}; |
|
17 |
+ % my $value = $line->{value}; |
|
18 |
+ % my $status = stash('status') || ''; |
|
19 |
+ % if ($class eq 'binary_file') { |
|
20 |
+ Binary files |
|
21 |
+ <a href="<%= url_for("/$user/$project/blob/$from_id/$file") %>">a/<%= $file %></a> |
|
22 |
+ and |
|
23 |
+ <a href="<%= url_for("/$user/$project/blob/$id/$file") %>">b/<%= $file %></a> |
|
24 |
+ differ |
|
25 |
+ % last; |
|
32 | 26 |
% } else { |
33 |
- % $bk_color = ''; |
|
27 |
+ <% |
|
28 |
+ my $bk_color_line = ''; |
|
29 |
+ my $bk_color = ''; |
|
30 |
+ my $border_color; |
|
31 |
+ if ($value =~ /^@/) { |
|
32 |
+ $bk_color_line = '#f3f3ff'; |
|
33 |
+ $border_color = '#e4e4ff'; |
|
34 |
+ $bk_color = '#f8f8ff'; |
|
35 |
+ } elsif ($value =~ /^\+/) { |
|
36 |
+ $bk_color_line = '#ceffce'; |
|
37 |
+ $border_color = '#b4e2b4'; |
|
38 |
+ $bk_color = '#dfd'; |
|
39 |
+ } elsif ($value =~ /^-/) { |
|
40 |
+ $bk_color_line = '#f7c8c8'; |
|
41 |
+ $border_color = '#e9aeae'; |
|
42 |
+ $bk_color = '#fdd'; |
|
43 |
+ } else { |
|
44 |
+ $border_color = '#e5e5e5'; |
|
45 |
+ } |
|
46 |
+ %> |
|
47 |
+ <tr> |
|
48 |
+ <td style="color:#aaa;padding-left:7px;border-right:1px <%= $border_color %> solid;background-color:<%= $bk_color_line %>;"> |
|
49 |
+ <%= $line->{before_line_num} %> |
|
50 |
+ </td> |
|
51 |
+ <td style="color:#aaa;padding-left:7px;border-right:1px <%= $border_color %> solid;background-color:<%= $bk_color_line %>;"> |
|
52 |
+ <%= $line->{after_line_num} %> |
|
53 |
+ </td> |
|
54 |
+ <td style="width:100%;padding-left:7px;background-color:<%= $bk_color %>;"> |
|
55 |
+ <%= $value %> |
|
56 |
+ </td> |
|
57 |
+ </tr> |
|
34 | 58 |
% } |
35 |
- <div style="padding-left:5px;background-color:<%= $bk_color %>;"> |
|
36 |
- <%= $value %> |
|
37 |
- </div> |
|
38 | 59 |
% } |
39 |
- % } |
|
60 |
+ </table> |
|
40 | 61 |
</div> |
41 | 62 |
<div class="vspace20"></div> |