... | ... |
@@ -830,8 +830,8 @@ sub parse_blobdiff_lines { |
830 | 830 |
|
831 | 831 |
# Parse |
832 | 832 |
my @lines; |
833 |
- my $delete_count_rest; |
|
834 |
- my $add_count_rest; |
|
833 |
+ my $next_before_line_num; |
|
834 |
+ my $next_after_line_num; |
|
835 | 835 |
for my $line (@$lines) { |
836 | 836 |
chomp $line; |
837 | 837 |
|
... | ... |
@@ -839,17 +839,32 @@ sub parse_blobdiff_lines { |
839 | 839 |
my $before_line_num; |
840 | 840 |
my $after_line_num; |
841 | 841 |
|
842 |
- if ($line =~ /^diff \-\-git /) { $class = 'header' } |
|
843 |
- elsif ($line =~ /^\@\@/) { $class = 'chunk_header' } |
|
844 |
- elsif ($line =~ /^\- /) { $class = 'from_file' } |
|
845 |
- elsif ($line =~ /^\+ /) { $class = 'to_file' } |
|
842 |
+ if ($line =~ /^\@\@\s-(\d+),\d+\s\+(\d+),\d+/) { |
|
843 |
+ $next_before_line_num = $1; |
|
844 |
+ $next_after_line_num = $2; |
|
845 |
+ |
|
846 |
+ $before_line_num = '...'; |
|
847 |
+ $after_line_num = '...'; |
|
848 |
+ |
|
849 |
+ $class = 'chunk_header'; |
|
850 |
+ } |
|
851 |
+ elsif ($line =~ /^\- /) { |
|
852 |
+ $class = 'from_file'; |
|
853 |
+ $before_line_num = $next_before_line_num--; |
|
854 |
+ $after_line_num = ''; |
|
855 |
+ } |
|
856 |
+ elsif ($line =~ /^\+ /) { |
|
857 |
+ $class = 'to_file'; |
|
858 |
+ $before_line_num = ''; |
|
859 |
+ $after_line_num = $next_after_line_num--; |
|
860 |
+ } |
|
846 | 861 |
elsif ($line =~ /^Binary files/) { $class = 'binary_file' } |
847 |
- elsif ($line =~ /^deleted/ |
|
848 |
- || $line =~ /^index / |
|
849 |
- || $line =~ /^--- / |
|
850 |
- || $line =~ /^\+\+\+ / |
|
851 |
- ) { next } |
|
852 |
- else { $class = 'diff' } |
|
862 |
+ elsif ($line =~ /^ /) { |
|
863 |
+ $class = 'diff'; |
|
864 |
+ $before_line_num = $next_before_line_num--; |
|
865 |
+ $after_line_num = $next_after_line_num--; |
|
866 |
+ } |
|
867 |
+ else { next } |
|
853 | 868 |
|
854 | 869 |
my $line_data = { |
855 | 870 |
value => $line, |
... | ... |
@@ -1,22 +1,21 @@ |
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> |
|
12 |
+ </div> |
|
13 |
+ </div> |
|
2 | 14 |
% for my $line (@$lines) { |
3 | 15 |
% my $class = $line->{class}; |
4 | 16 |
% my $value = $line->{value}; |
5 | 17 |
% my $status = stash('status') || ''; |
6 |
- % if ($class eq 'header') { |
|
7 |
- <div class="border-bottom-gray padding5 bk-gray-light"> |
|
8 |
- <div class="row"> |
|
9 |
- <div class="span8" style="padding-top:6px"> |
|
10 |
- <%= $file %> |
|
11 |
- </div> |
|
12 |
- <div class="span3 offset1-mini text-right"> |
|
13 |
- <a class="btn" href="<%= url_for("/$user/$project/blob/$id/$file") %>"> |
|
14 |
- View file @ <%= substr($id, 0, 7) %> |
|
15 |
- </a> |
|
16 |
- </div> |
|
17 |
- </div> |
|
18 |
- </div> |
|
19 |
- % } elsif ($class eq 'binary_file') { |
|
18 |
+ % if ($class eq 'binary_file') { |
|
20 | 19 |
Binary files |
21 | 20 |
<a href="<%= url_for("/$user/$project/blob/$from_id/$file") %>">a/<%= $file %></a> |
22 | 21 |
and |
... | ... |
@@ -24,8 +23,8 @@ |
24 | 23 |
differ |
25 | 24 |
% } else { |
26 | 25 |
% my $bk_color; |
27 |
- % if ($value =~ /^@/) { |
|
28 |
- % $bk_color = '#eee'; |
|
26 |
+ % if ($value =~ /^@@ /) { |
|
27 |
+ % $bk_color = '#eef'; |
|
29 | 28 |
% } elsif ($value =~ /^\+/) { |
30 | 29 |
% $bk_color = '#ddffdd'; |
31 | 30 |
% } elsif ($value =~ /^-/) { |