66
|
66
|
|
|
67
|
67
|
|
<div class="message">{{ commit.message }}</div>
|
68
|
68
|
|
|
|
69
|
+ |
<div>
|
|
70
|
+ |
<details>
|
|
71
|
+ |
<summary>Diff options</summary>
|
|
72
|
+ |
<form action="" method="get">
|
|
73
|
+ |
<table>
|
|
74
|
+ |
<tr>
|
|
75
|
+ |
<td>
|
|
76
|
+ |
View
|
|
77
|
+ |
</td>
|
|
78
|
+ |
<td>
|
|
79
|
+ |
<label><input type="radio" name="mode" value="udiff" {{ 'checked' if mode == 'udiff' }}>Unified</label>
|
|
80
|
+ |
<label><input type="radio" name="mode" value="ssdiff" {{ 'checked' if mode == 'ssdiff' }}>Side by side</label>
|
|
81
|
+ |
</td>
|
|
82
|
+ |
</tr>
|
|
83
|
+ |
<tr>
|
|
84
|
+ |
<td>
|
|
85
|
+ |
Context lines
|
|
86
|
+ |
</td>
|
|
87
|
+ |
<td>
|
|
88
|
+ |
<input type="number" min=0 max=1000 name="context_lines" value="{{ context_lines }}" />
|
|
89
|
+ |
</td>
|
|
90
|
+ |
</tr>
|
|
91
|
+ |
<tr>
|
|
92
|
+ |
<td>
|
|
93
|
+ |
Inter-hunk lines
|
|
94
|
+ |
</td>
|
|
95
|
+ |
<td>
|
|
96
|
+ |
<input type="number" min=0 max=1000 name="inter_hunk_lines" value="{{ inter_hunk_lines }}" />
|
|
97
|
+ |
</td>
|
|
98
|
+ |
</tr>
|
|
99
|
+ |
<tr>
|
|
100
|
+ |
<td>
|
|
101
|
+ |
Side
|
|
102
|
+ |
</td>
|
|
103
|
+ |
<td>
|
|
104
|
+ |
<label><input type="radio" name="side" value="normal" {{ 'checked' if side == 'normal' }}>Normal</label>
|
|
105
|
+ |
<label><input type="radio" name="side" value="reverse" {{ 'checked' if side == 'reverse' }}>Reverse</label>
|
|
106
|
+ |
</td>
|
|
107
|
+ |
</tr>
|
|
108
|
+ |
<tr>
|
|
109
|
+ |
<td>
|
|
110
|
+ |
Whitespace
|
|
111
|
+ |
</td>
|
|
112
|
+ |
<td>
|
|
113
|
+ |
<label><input type="radio" name="whitespace" value="include" {{ 'checked' if whitespace == 'include' }}>Include</label>
|
|
114
|
+ |
<label><input type="radio" name="whitespace" value="ignore_all" {{ 'checked' if whitespace == 'ignore_all' }}>Ignore all</label>
|
|
115
|
+ |
<label><input type="radio" name="whitespace" value="ignore_change" {{ 'checked' if whitespace == 'ignore_change' }}>Ignore amount changes</label>
|
|
116
|
+ |
<label><input type="radio" name="whitespace" value="ignore_eol" {{ 'checked' if whitespace == 'ignore_eol' }}>Ignore at end of line</label>
|
|
117
|
+ |
</td>
|
|
118
|
+ |
</tr>
|
|
119
|
+ |
</table>
|
|
120
|
+ |
<input type="submit" value="Update" />
|
|
121
|
+ |
</form>
|
|
122
|
+ |
</details>
|
|
123
|
+ |
</div>
|
|
124
|
+ |
|
69
|
125
|
|
{% for patch in diff %}
|
70
|
126
|
|
|
71
|
127
|
|
<table class="diff">
|
72
|
128
|
|
|
73
|
129
|
|
{# The following status values are defined in the git_delta_t enum
|
74
|
130
|
|
# in libgit2. See https://github.com/libgit2/libgit2/blob/main/include/git2/diff.h
|
|
131
|
+ |
# 0 = UNCHANGED
|
|
132
|
+ |
# 1 = ADDED (does not exist in old version)
|
|
133
|
+ |
# 2 = DELETED (does not exist in new version)
|
|
134
|
+ |
# 3 = MODIFIED (content changed between old and new versions)
|
|
135
|
+ |
# 4 = RENAMED
|
|
136
|
+ |
# 5 = COPIED
|
|
137
|
+ |
# ... (there are other codes that we don't use)
|
75
|
138
|
|
#}
|
76
|
|
- |
|
77
|
|
- |
{# 1=ADDED (does not exist in old version) #}
|
78
|
|
- |
{# 2=DELETED (does not exist in new version) #}
|
79
|
|
- |
{# 3=MODIFIED (content changed between old and new versions) #}
|
80
|
|
- |
{# 4=RENAMED #}
|
81
|
|
- |
{# 5=COPIED #}
|
82
|
139
|
|
<thead>
|
83
|
140
|
|
<tr>
|
84
|
141
|
|
<td colspan="4">
|
136
|
193
|
|
{% endif %}
|
137
|
194
|
|
|
138
|
195
|
|
{% for hunk in patch.hunks if not patch.delta.is_binary %}
|
139
|
|
- |
|
140
|
|
- |
<tr class="header">
|
141
|
|
- |
<td></td>
|
142
|
|
- |
<td></td>
|
143
|
|
- |
<td></td>
|
144
|
|
- |
<td>{{ hunk.header }}</td>
|
145
|
|
- |
</tr>
|
146
|
196
|
|
|
147
|
|
- |
{% for line in hunk.lines %}
|
148
|
|
- |
<tr class="{{ 'insertion' if line.old_lineno < 0 }} {{ 'deletion' if line.new_lineno < 0 }}">
|
149
|
|
- |
<td class="lineno">
|
150
|
|
- |
{% if line.old_lineno >= 0 %}
|
151
|
|
- |
{{ line.old_lineno }}
|
152
|
|
- |
{% endif %}
|
153
|
|
- |
</td>
|
154
|
|
- |
<td class="lineno">
|
155
|
|
- |
{% if line.new_lineno >= 0 %}
|
156
|
|
- |
{{ line.new_lineno }}
|
157
|
|
- |
{% endif %}
|
158
|
|
- |
</td>
|
159
|
|
- |
<td class="origin">{{ line.origin }}</td>
|
160
|
|
- |
<td class="content">{{ line.content }}</td>
|
|
197
|
+ |
{#### UDIFF mode ####}
|
|
198
|
+ |
|
|
199
|
+ |
{% if mode == 'udiff' %}
|
|
200
|
+ |
<tr class="header">
|
|
201
|
+ |
<td></td>
|
|
202
|
+ |
<td></td>
|
|
203
|
+ |
<td></td>
|
|
204
|
+ |
<td>{{ hunk.header }}</td>
|
161
|
205
|
|
</tr>
|
162
|
|
- |
{% endfor %}
|
|
206
|
+ |
|
|
207
|
+ |
{% for line in hunk.lines %}
|
|
208
|
+ |
<tr class="udiff {{ 'insertion' if line.old_lineno < 0 }} {{ 'deletion' if line.new_lineno < 0 }}">
|
|
209
|
+ |
<td class="lineno">
|
|
210
|
+ |
{% if line.old_lineno >= 0 %}
|
|
211
|
+ |
{{ line.old_lineno }}
|
|
212
|
+ |
{% endif %}
|
|
213
|
+ |
</td>
|
|
214
|
+ |
<td class="lineno">
|
|
215
|
+ |
{% if line.new_lineno >= 0 %}
|
|
216
|
+ |
{{ line.new_lineno }}
|
|
217
|
+ |
{% endif %}
|
|
218
|
+ |
</td>
|
|
219
|
+ |
<td class="origin">{{ line.origin }}</td>
|
|
220
|
+ |
<td class="content">{{ line.content }}</td>
|
|
221
|
+ |
</tr>
|
|
222
|
+ |
{% endfor %}
|
|
223
|
+ |
{% endif %}
|
|
224
|
+ |
|
|
225
|
+ |
{#### SSDIFF mode ####}
|
|
226
|
+ |
|
|
227
|
+ |
{% if mode == 'ssdiff' %}
|
|
228
|
+ |
{% macro print_buffer(buffer_deletions, buffer_insertions) %}
|
|
229
|
+ |
{% for buffer_del, buffer_ins in zip_longest(buffer_deletions, buffer_insertions) %}
|
|
230
|
+ |
<tr class="ssdiff">
|
|
231
|
+ |
{% if buffer_del %}
|
|
232
|
+ |
<td class="lineno">
|
|
233
|
+ |
{{ buffer_del.old_lineno }}
|
|
234
|
+ |
</td>
|
|
235
|
+ |
<td class="content {{ 'deletion' if buffer_insertions|length == 0 else 'change' }}">{{ buffer_del.content }}</td>
|
|
236
|
+ |
{% else %}
|
|
237
|
+ |
<td class="lineno">
|
|
238
|
+ |
</td>
|
|
239
|
+ |
<td class="content"></td>
|
|
240
|
+ |
{% endif %}
|
|
241
|
+ |
|
|
242
|
+ |
{% if buffer_ins %}
|
|
243
|
+ |
<td class="lineno">
|
|
244
|
+ |
{{ buffer_ins.new_lineno }}
|
|
245
|
+ |
</td>
|
|
246
|
+ |
<td class="content {{ 'insertion' if buffer_deletions|length == 0 else 'change' }}">{{ buffer_ins.content }}</td>
|
|
247
|
+ |
{% else %}
|
|
248
|
+ |
<td class="lineno">
|
|
249
|
+ |
</td>
|
|
250
|
+ |
<td class="content"></td>
|
|
251
|
+ |
{% endif %}
|
|
252
|
+ |
</tr>
|
|
253
|
+ |
{% endfor %}
|
|
254
|
+ |
|
|
255
|
+ |
{# .clear() empties the buffer. However since it requires
|
|
256
|
+ |
# {{}} brackets instead of {%%}, this line will print the
|
|
257
|
+ |
# value of "buffer_deletions" which is "None".
|
|
258
|
+ |
# "or ''" is a hack for printing an empty line instead of "None".
|
|
259
|
+ |
#}
|
|
260
|
+ |
{{ buffer_deletions.clear() or '' }}
|
|
261
|
+ |
{{ buffer_insertions.clear() or '' }}
|
|
262
|
+ |
{% endmacro %}
|
|
263
|
+ |
|
|
264
|
+ |
<tr class="header">
|
|
265
|
+ |
<td colspan=4>{{ hunk.header }}</td>
|
|
266
|
+ |
</tr>
|
|
267
|
+ |
|
|
268
|
+ |
{% set buffer_deletions = [] %}
|
|
269
|
+ |
{% set buffer_insertions = [] %}
|
|
270
|
+ |
|
|
271
|
+ |
{% for line in hunk.lines %}
|
|
272
|
+ |
{% if line.old_lineno < 0 %}
|
|
273
|
+ |
{{ buffer_insertions.append(line) or '' }}
|
|
274
|
+ |
{% endif %}
|
|
275
|
+ |
|
|
276
|
+ |
{% if line.new_lineno < 0 %}
|
|
277
|
+ |
{{ buffer_deletions.append(line) or '' }}
|
|
278
|
+ |
{% endif %}
|
|
279
|
+ |
|
|
280
|
+ |
{% if line.old_lineno >= 0 and line.new_lineno >= 0 %}
|
|
281
|
+ |
|
|
282
|
+ |
{# Unload buffer #}
|
|
283
|
+ |
{{ print_buffer(buffer_deletions, buffer_insertions) }}
|
|
284
|
+ |
|
|
285
|
+ |
<tr class="ssdiff">
|
|
286
|
+ |
<td class="lineno">
|
|
287
|
+ |
{{ line.old_lineno }}
|
|
288
|
+ |
</td>
|
|
289
|
+ |
<td class="content">{{ line.content }}</td>
|
|
290
|
+ |
|
|
291
|
+ |
<td class="lineno">
|
|
292
|
+ |
{{ line.new_lineno }}
|
|
293
|
+ |
</td>
|
|
294
|
+ |
<td class="content">{{ line.content }}</td>
|
|
295
|
+ |
</tr>
|
|
296
|
+ |
{% endif %}
|
|
297
|
+ |
{% endfor %}
|
|
298
|
+ |
|
|
299
|
+ |
{# Empty remaining buffer #}
|
|
300
|
+ |
{{ print_buffer(buffer_deletions, buffer_insertions) }}
|
|
301
|
+ |
{% endif %}
|
163
|
302
|
|
|
164
|
303
|
|
{% endfor %}
|
165
|
304
|
|
</tbody>
|