-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Quality of life improvements for Changelog, History and Diff views
- History: now displayed via GET and /../history/rev_a/rev_b instead of POST submitted reuqest. To not mess up the history and be able to link the diff. - Diff: The displayed chunks/the lines of the chunks were not correctly ordered. Now what is displayed matches what a unidiff looks like. - Changelog/Show commit: Now the /commit/ can handle renamed, deleted or created files much better. In case of an edit the diff is shown.
- Loading branch information
Showing
8 changed files
with
152 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,79 @@ | ||
{# vim: set et ts=8 sts=4 sw=4 ai: #} | ||
{% if pagepath %} | ||
{% extends "page.html" %} | ||
{% else %} | ||
{% extends "wiki.html" %} | ||
{% endif %} | ||
|
||
|
||
{% block menu %} | ||
{{ super() }} | ||
{% if not pagepath and menutree %} | ||
{% include 'snippets/menutree.html' %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="w-full mw-full p-0 clearfix"> | ||
{% if rev_a and rev_b %} | ||
<h3>Comparing <tt>{{rev_a}}</tt> to <tt>{{rev_b}}</tt></h3> | ||
{% endif %} | ||
{% if revision %} | ||
{% elif revision %} | ||
<h3>Commit <tt>{{revision}}</tt></h3> | ||
{% endif %} | ||
{% if metadata %} | ||
<span class="datetime" title="{{metadata.datetime|format_datetime("deltanow")}} ago">{{metadata.datetime|format_datetime}}</span> | ||
{%if not metadata.author_email%}{{metadata.author_name}}{%else%}<a href="mailto:{{metadata.author_email}}">{{metadata.author_name}}</a>{%endif%}: | ||
{{metadata.message or '-/-'|safe}} | ||
{%endif%} | ||
<table class="diff"> | ||
{% if patchset %} | ||
{% for file in patchset %} | ||
{# file.path #} {# file.added #} {# file.removed #} | ||
{% with filename=file.path,lines=file_diffs[file.path],urlobj=url_map[file.path] %} | ||
{# {{filename}} {{lines}} {{file}} #} | ||
{%- if page_filename|length == 0 or filename == page_filename %} | ||
<tr> | ||
<td class="filename" colspan="{%if withlinenumbers %}4{%else%}2{%endif%}"> | ||
<a href="{{url_map[file.path][1]}}">{{url_map[file.path][0]}}</a> | ||
{%- if urlobj.source_file == urlobj.target_file %} | ||
<tt>{{urlobj.source_file}}</tt> <a href="{{urlobj.source_url}}" class="revision-small">{{rev_a}}</a> .. | ||
<a href="{{urlobj.target_url}}" class="revision-small">{{rev_b}}</a> | ||
{%- else %} | ||
{%- if urlobj.source_url %} | ||
<a href="{{urlobj.source_url}}"><tt>{{urlobj.source_file}}</tt></a> | ||
{%- else %} | ||
<tt>{{urlobj.source_file}}</tt> | ||
{%- endif %} | ||
.. | ||
{%- if urlobj.target_url %} | ||
<a href="{{urlobj.target_url}}"><tt>{{urlobj.target_file}}</tt></a> | ||
{%- else %} | ||
<tt>{{urlobj.target_file}}</tt> | ||
{%- endif %} | ||
{%- endif %} | ||
{# | ||
{%- elif rev_a and rev_b %} | ||
<tt>{{url_map[filename][0][0]}}</tt> <a href="{{url_map[filename][0][1]}}" class="revision-small">{{rev_a}}</a> .. <a href="{{url_map[filename][1][1]}}" class="revision-small">{{rev_b}}</a> | ||
{%- endif %} | ||
#} | ||
</td> | ||
</tr> | ||
{% for hunk in file %} | ||
<tr> | ||
<td class="hunk" colspan="{%if withlinenumbers %}4{%else%}2{%endif%}">@@ {{hunk.source_start}},{{hunk.source_length}} {{hunk.target_start}},{{hunk.target_length}}@@ </td> | ||
</tr> | ||
{% for i,lines in hunk_helper[(file.source_file, file.target_file, hunk.source_start, hunk.source_length)].items() -%} | ||
{% for l in lines %} | ||
<tr class="{{l.style}}"> | ||
{%- if l.style == "hunk" %} | ||
<td class="hunk" colspan="{%if withlinenumbers %}4{%else%}2{%endif%}">{{l.value}}</td> | ||
{%- else %} | ||
{%-if withlinenumbers -%} | ||
<td class="diff-decoration">{{l.source}}</td> | ||
<td class="diff-decoration">{{l.target}}</td> | ||
{%- endif -%} | ||
<td class="diff-decoration">{{l.type}}</td> | ||
<td>{{l.value | replace('\n', '')}}</td> | ||
<td class="value">{{l.value | replace('\n', '')}}</td> | ||
{%- endif -%} | ||
</tr> | ||
{%- endfor -%}{# l in lines #} | ||
{%- endfor %}{# lines in hunk_helper #} | ||
|
||
{# | ||
{% for l in hunk.source_lines()-%} | ||
<tr style="background-color:#a00;"> | ||
<td style="width:1%;">{{l.source_line_no}}</td> | ||
<td style="width:1%;">{{l.target_line_no}}</td> | ||
<td style="width:1%;">{{l.line_type}}</td> | ||
<td>{{l.value}}</td> | ||
</tr> | ||
{% endfor %} | ||
{% for l in hunk.target_lines()-%} | ||
<tr style="background-color:#0a0;"> | ||
<td style="width:1%;">{{l.source_line_no}}</td> | ||
<td style="width:1%;">{{l.target_line_no}}</td> | ||
<td style="width:1%;">{{l.line_type}}</td> | ||
<td>{{l.value}}</td> | ||
</tr> | ||
{% endfor %} | ||
#} | ||
|
||
{% endfor %}{# hunk in file #} | ||
{% endfor %}{# file in patchset #} | ||
{%- else -%} | ||
<!-- skipped page_filename={{page_filename}} filename={{filename}} --> | ||
{%- endif %} | ||
{% endwith %}{# filenname,lines in file_diffs #} | ||
{% endfor %}{# filenname,lines in file_diffs #} | ||
</table> | ||
{% endif %} | ||
{######} | ||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.