{% extends "repo.html" %} {% set active_page = "log" %} {% block title %} {% trans basename=basename, username=username, repository=repository %}{{ basename }} in {{ username }}/{{ repository }}{% endtrans %} {% endblock %} {% block content %} {% for file in diff %}

{{ file }}

{% set vars = namespace(original_line=0, modified_line=0, hunk_started=false) %} {% for line in diff[file] %} {% if line.startswith("@@") %} {% if vars.hunk_started %} {% endif %} {% set vars.hunk_started = true %} {% set diff_location = line|parse_diff_location %} {% set vars.original_line = diff_location[0][0] %} {% set vars.modified_line = diff_location[1][0] %}

{{ line }}

 
                {% elif vars.hunk_started %}
                    {% if line.startswith("+") %}
                        
{{ vars.modified_line }} +
{{ line[1:] }} {% set vars.modified_line = vars.modified_line + 1 %} {% elif line.startswith("-") %}
{{ vars.original_line }} -
{{ line[1:] }} {% set vars.original_line = vars.original_line + 1 %} {% else %} {% if line %}
{{ vars.modified_line }}  
{{ line }} {% endif %} {% if not line.startswith("@@") %} {% set vars.original_line = vars.original_line + 1 %} {% set vars.modified_line = vars.modified_line + 1 %} {% endif %} {% endif %} {% endif %} {% endfor %} {% if vars.hunk_started %}
{% endif %} {% endfor %}
{% endblock %}