Mercurial > kallithea
changeset 2359:a264d898ca08 beta
Alwas show initial context on html diffs.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 30 May 2012 20:46:37 +0200 |
parents | 69df04ee1e2b |
children | c15c3430df74 |
files | rhodecode/lib/diffs.py |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/diffs.py Tue May 29 23:38:33 2012 +0200 +++ b/rhodecode/lib/diffs.py Wed May 30 20:46:37 2012 +0200 @@ -286,8 +286,6 @@ files = [] try: line = lineiter.next() - # skip first context - skipfirst = True while 1: # continue until we found the old file if not line.startswith('--- '): @@ -317,22 +315,23 @@ [int(x or 1) for x in match.groups()[:-1]] old_line -= 1 new_line -= 1 - context = len(match.groups()) == 5 + gr = match.groups() + context = len(gr) == 5 old_end += old_line new_end += new_line if context: - if not skipfirst: + # skip context only if it's first line + if int(gr[0]) > 1: lines.append({ 'old_lineno': '...', 'new_lineno': '...', 'action': 'context', 'line': line, }) - else: - skipfirst = False line = lineiter.next() + while old_line < old_end or new_line < new_end: if line: command, line = line[0], line[1:]