# HG changeset patch # User Mads Kiilerich # Date 2021-02-21 23:53:59 # Node ID 0ce9f0754a46b065491244d87e459c1be5d281dc # Parent ba7c0397c3c197f945fe32632605495f057e0284 diffs: drop pointless check for adding context line The length of the match was always 5. diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py --- a/kallithea/lib/diffs.py +++ b/kallithea/lib/diffs.py @@ -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)