diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py --- a/kallithea/lib/diffs.py +++ b/kallithea/lib/diffs.py @@ -107,12 +107,9 @@ def as_html(table_class='code-difftable' 'filename': _safe_id(file_info['filename']), 'newline_no': change['new_lineno'] } - cond_old = (change['old_lineno'] != '...' and - change['old_lineno']) - cond_new = (change['new_lineno'] != '...' and - change['new_lineno']) - no_lineno = (change['old_lineno'] == '...' and - change['new_lineno'] == '...') + cond_old = change['old_lineno'] + cond_new = change['new_lineno'] + no_lineno = not change['old_lineno'] and not change['new_lineno'] if cond_old: anchor_old_id = 'id="%s"' % anchor_old if cond_new: @@ -587,8 +584,8 @@ def _parse_lines(diff_lines): # skip context only if it's first line if int(gr[0]) > 1: lines.append({ - 'old_lineno': '...', - 'new_lineno': '...', + 'old_lineno': '', + 'new_lineno': '', 'action': 'context', 'line': line, }) @@ -632,8 +629,8 @@ def _parse_lines(diff_lines): # we need to append to lines, since this is not # counted in the line specs of diff lines.append({ - 'old_lineno': '...', - 'new_lineno': '...', + 'old_lineno': '', + 'new_lineno': '', 'action': 'context', 'line': line, }) diff --git a/kallithea/tests/models/test_diff_parsers.py b/kallithea/tests/models/test_diff_parsers.py --- a/kallithea/tests/models/test_diff_parsers.py +++ b/kallithea/tests/models/test_diff_parsers.py @@ -295,7 +295,7 @@ class TestDiffLib(base.TestController): l.append('%(action)-7s %(new_lineno)3s %(old_lineno)3s %(line)r\n' % d) s = ''.join(l) assert s == r''' -context ... ... '@@ -51,6 +51,13 @@\n' +context '@@ -51,6 +51,13 @@\n' unmod 51 51 '\tbegin();\n' unmod 52 52 '\t\n' add 53 '\tint foo;\n'