Changeset - 0ce9f0754a46
[Not reviewed]
default
0 1 0
Mads Kiilerich - 5 years ago 2021-02-21 23:53:59
mads@kiilerich.com
diffs: drop pointless check for adding context line

The length of the match was always 5.
1 file changed with 8 insertions and 10 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/diffs.py
Show inline comments
 
@@ -629,19 +629,17 @@ def _parse_lines(diff_lines):
 
            old_line -= 1
 
            new_line -= 1
 

	
 
            context = len(gr) == 5
 
            old_end += old_line
 
            new_end += new_line
 

	
 
            if context:
 
                # skip context only if it's first line
 
                if int(gr[0]) > 1:
 
                    lines.append({
 
                        'old_lineno': '',
 
                        'new_lineno': '',
 
                        'action':     'context',
 
                        'line':       line,
 
                    })
 
            # include '@@' line if it gives a line number hint or separate chunks - not if the chunk starts at start of file like '@@ -1,7 +1,7 @@'
 
            if int(gr[0]) > 1:
 
                lines.append({
 
                    'old_lineno': '',
 
                    'new_lineno': '',
 
                    'action':     'context',
 
                    'line':       line,
 
                })
 

	
 
            line = next(diff_lines)
 

	
0 comments (0 inline, 0 general)