Mercurial > kallithea
changeset 2360:c15c3430df74 beta
fixed issue with git's `no new line..` messages inside diff block. It might sometimes happen that showed html diff was short one line because of this
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 30 May 2012 21:12:04 +0200 |
parents | a264d898ca08 |
children | 948c16bb9476 b902baeaa494 |
files | rhodecode/lib/diffs.py |
diffstat | 1 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/diffs.py Wed May 30 20:46:37 2012 +0200 +++ b/rhodecode/lib/diffs.py Wed May 30 21:12:04 2012 +0200 @@ -352,14 +352,24 @@ affects_old = affects_new = True action = 'unmod' - old_line += affects_old - new_line += affects_new - lines.append({ - 'old_lineno': affects_old and old_line or '', - 'new_lineno': affects_new and new_line or '', - 'action': action, - 'line': line - }) + if line.find('No newline at end of file') != -1: + lines.append({ + 'old_lineno': '...', + 'new_lineno': '...', + 'action': 'context', + 'line': line + }) + + else: + old_line += affects_old + new_line += affects_new + lines.append({ + 'old_lineno': affects_old and old_line or '', + 'new_lineno': affects_new and new_line or '', + 'action': action, + 'line': line + }) + line = lineiter.next() except StopIteration: @@ -369,13 +379,12 @@ for _ in files: for chunk in chunks: lineiter = iter(chunk) - #first = True try: while 1: line = lineiter.next() if line['action'] != 'unmod': nextline = lineiter.next() - if nextline['action'] == 'unmod' or \ + if nextline['action'] in ['unmod', 'context'] or \ nextline['action'] == line['action']: continue self.differ(line, nextline)