git @ Cat's Eye Technologies klaus / 6e08cce
Fix #130 Jonas Haag 9 years ago
4 changed file(s) with 14 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
22 env/
33 .idea
44 *.swp
5 tests/repos/
5 tests/repos/build
66 *.egg-info
77 build/
88 dist/
8888
8989 in_header = False
9090 chunks = []
91 adds, dels = 0, 0
9291 files.append({
9392 'is_header': False,
9493 'old_filename': self._extract_filename(line),
9594 'new_filename': self._extract_filename(next(lineiter)),
96 'additions': adds,
97 'deletions': dels,
95 'additions': 0,
96 'deletions': 0,
9897 'chunks': chunks
9998 })
10099
126125 if command == '+':
127126 affects_new = True
128127 action = 'add'
129 adds += 1
128 files[-1]['additions'] += 1
130129 elif command == '-':
131130 affects_old = True
132131 action = 'del'
133 dels += 1
132 files[-1]['deletions'] += 1
134133 else:
135134 affects_old = affects_new = True
136135 action = 'unmod'
141140 'old_lineno': affects_old and old_line or u'',
142141 'new_lineno': affects_new and new_line or u'',
143142 'action': action,
144 'line': line
143 'line': line,
144 'no_newline': False,
145145 })
146 # Make sure to store the stats before a
147 # StopIteration is raised
148 files[-1]['additions'] = adds
149 files[-1]['deletions'] = dels
146
147 # Skip "no newline at end of file" markers
150148 line = next(lineiter)
149 if line == "\ No newline at end of file":
150 lines[-1]['no_newline'] = True
151 line = next(lineiter)
151152
152153 except StopIteration:
153154 pass
253253 .diff tr:last-of-type td { padding-bottom: 7px; }
254254 .diff table .del { background-color: #ffdddd; }
255255 .diff table .add { background-color: #ddffdd; }
256 .diff table .no-newline-marker { font-size: 50%; margin-left: 5px; color: red; }
256257 .diff table del { background-color: #ee9999; text-decoration: none; }
257258 .diff table ins { background-color: #99ee99; text-decoration: none; }
258259 .diff .sep > td {
110110 {%- endif -%}
111111
112112 {#- the actual line of code -#}
113 <span class=line>{% autoescape false %}{{ line.line|force_unicode }}{% endautoescape %}</span>
113 <span class=line>{% autoescape false %}{{ line.line|force_unicode }}{% endautoescape %}{% if line.no_newline %}<span class="hastooltip no-newline-marker" title="No newline at end of file">⏎</span>{% endif %}</span>
114114 </td>
115115
116116 </tr>