Fix #130
Jonas Haag
9 years ago
2 | 2 |
env/
|
3 | 3 |
.idea
|
4 | 4 |
*.swp
|
5 | |
tests/repos/
|
|
5 |
tests/repos/build
|
6 | 6 |
*.egg-info
|
7 | 7 |
build/
|
8 | 8 |
dist/
|
88 | 88 |
|
89 | 89 |
in_header = False
|
90 | 90 |
chunks = []
|
91 | |
adds, dels = 0, 0
|
92 | 91 |
files.append({
|
93 | 92 |
'is_header': False,
|
94 | 93 |
'old_filename': self._extract_filename(line),
|
95 | 94 |
'new_filename': self._extract_filename(next(lineiter)),
|
96 | |
'additions': adds,
|
97 | |
'deletions': dels,
|
|
95 |
'additions': 0,
|
|
96 |
'deletions': 0,
|
98 | 97 |
'chunks': chunks
|
99 | 98 |
})
|
100 | 99 |
|
|
126 | 125 |
if command == '+':
|
127 | 126 |
affects_new = True
|
128 | 127 |
action = 'add'
|
129 | |
adds += 1
|
|
128 |
files[-1]['additions'] += 1
|
130 | 129 |
elif command == '-':
|
131 | 130 |
affects_old = True
|
132 | 131 |
action = 'del'
|
133 | |
dels += 1
|
|
132 |
files[-1]['deletions'] += 1
|
134 | 133 |
else:
|
135 | 134 |
affects_old = affects_new = True
|
136 | 135 |
action = 'unmod'
|
|
141 | 140 |
'old_lineno': affects_old and old_line or u'',
|
142 | 141 |
'new_lineno': affects_new and new_line or u'',
|
143 | 142 |
'action': action,
|
144 | |
'line': line
|
|
143 |
'line': line,
|
|
144 |
'no_newline': False,
|
145 | 145 |
})
|
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
|
150 | 148 |
line = next(lineiter)
|
|
149 |
if line == "\ No newline at end of file":
|
|
150 |
lines[-1]['no_newline'] = True
|
|
151 |
line = next(lineiter)
|
151 | 152 |
|
152 | 153 |
except StopIteration:
|
153 | 154 |
pass
|
253 | 253 |
.diff tr:last-of-type td { padding-bottom: 7px; }
|
254 | 254 |
.diff table .del { background-color: #ffdddd; }
|
255 | 255 |
.diff table .add { background-color: #ddffdd; }
|
|
256 |
.diff table .no-newline-marker { font-size: 50%; margin-left: 5px; color: red; }
|
256 | 257 |
.diff table del { background-color: #ee9999; text-decoration: none; }
|
257 | 258 |
.diff table ins { background-color: #99ee99; text-decoration: none; }
|
258 | 259 |
.diff .sep > td {
|
110 | 110 |
{%- endif -%}
|
111 | 111 |
|
112 | 112 |
{#- 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>
|
114 | 114 |
</td>
|
115 | 115 |
|
116 | 116 |
</tr>
|