{% extends "repo_master.html" %} {% from "_formhelper.html" import render_field_in_row, show_comment, render_bootstrap_field %} {% block title %} {%- if pull_request -%} PR#{{ requestid }}: {{ pull_request.title | noJS(ignore="img")}} {%- elif form and (g.repo_admin or remote_git) -%} Create new Pull Request for {{ branch_to }} {%- elif origin == 'compare_commits' -%} Diff from {{ commit1 }} to {{ commit2 }} {%- else -%} Diff from {{ branch_from }} to {{ branch_to }} {%- endif %} - {{ repo.namespace + '/' if repo.namespace }}{{ repo.name }} {% endblock %} {% set tag = "home" %} {% block header %} {% endblock %} {% block repo %}
{% if pull_request %}

PR#{{requestid}} {% if pull_request.status != 'Open'%} {{pull_request.status}} {% endif %} {{ pull_request.title | noJS(ignore="img") | safe}} {% if authenticated and (g.fas_user.username == pull_request.user.username or g.repo_admin) and pull_request.status == 'Open'%} {% if pull_request.status == 'Open' and authenticated and (g.repo_admin or g.fas_user.username == pull_request.user.username) %}
{% endif %}
{% if pull_request.status == 'Open' and authenticated and (g.repo_admin or g.fas_user.username == pull_request.user.username) %} {{ mergeform.csrf_token }} {% endif %}
{% if pull_request.status == 'Open' and authenticated and (g.repo_admin or g.fas_user.username == pull_request.user.username) %}
{% endif %}
{% endif %}

Proposed {{ pull_request.date_created |humanize }} by {{ pull_request.user.default_email | avatar(16) | safe }} {{ pull_request.user.user }}
From {{ pull_request.project_from.fullname or pull_request.remote_git }} {{ pull_request.branch_from }}  into {{ pull_request.project.fullname }} {{ pull_request.branch }} {%if pull_request and pull_request.initial_comment %}
{{ pull_request.initial_comment | markdown | noJS | safe }}
{%endif%} {% elif form and (g.repo_admin or remote_git) %}

Create pull request

{% else %}

Diff (tree)

{% if origin == 'compare_commits' %}
{{ commit1 }} .. {{ commit2 }}
{% endif %} {% endif %} {% if form and (g.repo_admin or remote_git) %}
{% if remote_git %}
{% else %} {% endif %}
Pull from {% if remote_git -%}{{ remote_git }}{%- else -%} {{ repo.fullname }} {%- endif -%} {{ branch_from }} into {% if repo.is_fork -%}{{ repo.parent.fullname }}{% else %}{{ repo.fullname }}{% endif %}  
{% if contributing %}
{{ contributing | markdown | noJS | safe}}
{% endif %} {{ render_bootstrap_field(form.title) }}
Preview {{ form.initial_comment(class_="form-control")|safe }}
{% if form.initial_comment.errors %} {% for error in form.initial_comment.errors %} {{ error }}  {% endfor %} {% endif %}

{{ form.csrf_token }} Cancel

{% endif %}
{% if authenticated and pull_request %}
{% endif %} {% if diff %} {% set count = 0 %} {% for patch in diff %} {% set count = count+1 %} {% if patch |hasattr('new_id') %} {% set patch_new_id = patch.new_id %} {% elif patch |hasattr('delta') %} {% set patch_new_id = patch.delta.new_file.id %} {% else %} {% set patch_new_id = patch.new_oid %} {% endif %} {% if patch |hasattr('old_id') %} {% set patch_old_id = patch.old_id %} {% elif patch |hasattr('delta') %} {% set patch_old_id = patch.delta.old_file.id %} {% else %} {% set patch_old_id = patch.old_oid %} {% endif %} {% if patch | hasattr('new_file_path') %} {% set patch_new_file_path = patch.new_file_path -%} {% if patch.new_file_path != patch.old_file_path %} {% set patch_old_file_path = patch.old_file_path %} {%- endif -%} {%- elif patch | hasattr('delta') -%} {% set patch_new_file_path = patch.delta.new_file.path -%} {%- if patch.delta.new_file.path != patch.delta.old_file.path -%} {% set patch_old_file_path = patch.delta.old_file.path %} {%- endif -%} {%- endif -%}
{% if patch | hasattr('additions') %} {# Version of pygit2 -0.21.4 -- F21/EL7 #} {% set linesadded = patch.additions %} {% set linesremoved = patch.deletions %} {% else %} {# Version of pygit2 -0.23.0 -- F23 #} {% set linesadded = patch.line_stats[1] %} {% set linesremoved = patch.line_stats[2] %} {% endif %} {% macro lineschanged(added, removed) -%} {%if added%} +{{linesadded}} {%endif%} {%if removed%} -{{linesremoved}} {%endif%} {%endmacro%} {% macro viewfilelink(filepath, identifier=False)%} {% if pull_request %} {% if not identifier %} {% set identifier = pull_request.branch_from %} {% endif %} {{filepath | unicode}} {% endmacro %} {% if patch | hasattr('new_file_path') %} {%- if patch.new_file_path == patch.old_file_path -%} {%- if patch.status == 'D' -%} {% set patchtype = "removed"%}
{{ viewfilelink(patch.new_file_path) }} {{ lineschanged(False, True) }}
file removed
{%-elif patch.status == 'A' -%} {% set patchtype = "added"%}
{{ viewfilelink(patch.new_file_path) }} {{ lineschanged(True, False) }}
file added
{%-elif patch.status == 'M' -%} {% set patchtype = "changed"%}
{{ viewfilelink(patch.new_file_path) }} {{ lineschanged(True, True) }}
file changed
{%-endif-%} {%- else -%} {% set patchtype = "moved"%} {{lineschanged(True, True)}}
{{patch.old_file_path}}
{{viewfilelink(patch.new_file_path)}}
file moved
{%- endif -%} {%- elif patch | hasattr('delta') -%} {%- if patch.delta.new_file.path == patch.delta.old_file.path -%} {%- if patch.delta.new_file.mode == 0 and patch.delta.old_file.mode == 33188 -%} {% set patchtype = "removed"%}
{{viewfilelink(patch.delta.new_file.path)}} {{lineschanged(False, True)}}
file removed
{%-elif patch.delta.new_file.mode == 33188 and patch.delta.old_file.mode == 0 -%} {% set patchtype = "added"%}
{{viewfilelink(patch.delta.new_file.path)}} {{lineschanged(True, False)}}
file added
{%-elif patch.delta.new_file.mode == 33188 and patch.delta.old_file.mode == 33188 -%} {% set patchtype = "changed"%}
{{ viewfilelink(patch.delta.new_file.path)}} {{lineschanged(True, True)}}
file changed
{%-endif-%} {%- else -%} {% set patchtype = "moved"%} {{lineschanged(True, True)}}
{{patch.delta.old_file.path}}
{{viewfilelink(patch.delta.new_file.path)}}
file moved
{%- endif -%} {%- endif -%}
{% if patchtype == "moved" and linesadded == 0 and linesremoved == 0%}
file was moved with no change to the file
{% elif patchtype == "added" and linesadded == 0 %}
empty file added
{% else %} {% if patchtype == "added" and linesadded > 1000 %}
The added file is too large to be shown here, see it at: {{ viewfilelink(patch_new_file_path) }}
{% elif patchtype == "removed" %}
The removed file is too large to be shown here, see it at: {{ viewfilelink(patch_new_file_path, patch_old_id) }}
{% else %} {% autoescape false %} {{ patch | patch_to_diff | html_diff | format_loc( filename=patch_new_file_path, commit=patch_new_id, prequest=pull_request, index=loop.index, tree_id=diff_commits[0].tree.id)}} {% endautoescape %} {% endif %} {% endif %}
{% endfor %} {% endif %} {% if authenticated and pull_request %} {{ mergeform.csrf_token }}
{% endif %}
{% if pull_request %}
{% if pull_request.comments %}
{% for comment in pull_request.comments %} {% if comment.commit_id %}
{{ comment.user.user }} commented on line {{ comment.line }} of {{ comment.filename }}.
{{ comment.date_created | humanize }}
(Show)
{{ comment.comment }}
{% elif comment.notification %}
{{ comment.date_created | humanize }}
{{ comment.comment | markdown | noJS | safe }}
{% else %} {{ show_comment(comment, comment.id, repo, username, requestid, form) }} {% endif %} {% endfor %} {{ mergeform.csrf_token }}
{% endif %}
{% if authenticated and mergeform and pull_request %}
{% if authenticated %}
{{ mergeform.csrf_token }}
Preview
Markdown Syntax
{% else %}

Login to comment on this ticket.

{% endif %}
{% endif %}
{% endif %}
{% if pull_request %}
{% if pull_request.status != 'Open'%} {% endif %} {% if pull_request.flags %}
    {% for flag in pull_request.flags %}
  • {{ flag.username }}
    {{ flag.percent }}%
    {{ flag.comment }}
    {{ flag.date_created | humanize }}
  • {% endfor %}
{% endif %}
{% if authenticated and mergeform and pull_request.status == 'Open' and g.repo_admin %}
{% endif %} {% if authenticated and mergeform and pull_request.status == 'Open' and g.repo_admin %}
{% endif %}
{% endif %} {% if diff and pull_request%}
Changes summary
{% macro changeschangedfile(filepath, added, removed, diffanchor) -%}
+{{added}} -{{removed}}
file changed
{%- endmacro %} {% macro changesrenamedfile(oldfilepath, newfilepath, added, removed, diffanchor) -%}
+{{added}} -{{removed}}
file renamed
{{oldfilepath}}
{{newfilepath}}
{%- endmacro %} {% macro changesdeletedfile(filepath, added, removed, diffanchor) -%}
-{{removed}}
file removed
{%- endmacro %} {% macro changesaddedfile(filepath, added, removed, diffanchor) -%}
+{{added}}
file added
{%- endmacro %}
{% set count = 0 %} {% for patch in diff %} {% set count = count+1 %}
{% if patch | hasattr('additions') %} {# Version of pygit2 -0.21.4 -- F21/EL7 #} {% set linesadded = patch.additions %} {% set linesremoved = patch.deletions %} {% else %} {# Version of pygit2 -0.23.0 -- F23 #} {% set linesadded = patch.line_stats[1] %} {% set linesremoved = patch.line_stats[2] %} {% endif %} {% if patch | hasattr('new_file_path') %} {%- if patch.new_file_path == patch.old_file_path -%} {%- if patch.status == 'D' -%} {{ changesdeletedfile(patch.new_file_path, linesadded, linesremoved, count) }} {%-elif patch.status == 'A' -%} {{ changesaddedfile(patch.new_file_path, linesadded, linesremoved, count) }} {%-elif patch.status == 'M' -%} {{ changeschangedfile(patch.new_file_path, linesadded, linesremoved, count) }} {%-endif-%} {%- else -%} {{changesrenamedfile(patch.old_file_path, patch.new_file_path, linesadded, linesremoved, count)}} {%- endif -%} {%- elif patch | hasattr('delta') -%} {%- if patch.delta.new_file.path == patch.delta.old_file.path -%} {%- if patch.delta.new_file.mode == 0 and patch.delta.old_file.mode == 33188 -%} {{ changesdeletedfile(patch.delta.new_file.path, linesadded, linesremoved, count) }} {%-elif patch.delta.new_file.mode == 33188 and patch.delta.old_file.mode == 0 -%} {{ changesaddedfile(patch.delta.new_file.path, linesadded, linesremoved, count) }} {%-elif patch.delta.new_file.mode == 33188 and patch.delta.old_file.mode == 33188 -%} {{ changeschangedfile(patch.delta.new_file.path, linesadded, linesremoved, count) }} {%-endif-%} {%- else -%} {{changesrenamedfile(patch.delta.old_file.path, patch.delta.new_file.path, linesadded, linesremoved, count)}} {%- endif -%} {%- endif -%}
{% endfor %}
{% endif %}
{% endblock %} {% block jscripts %} {{ super() }} {% if config['EVENTSOURCE_SOURCE'] and pull_request %} {% endif %} {% endblock %}