diff --git a/pagure/lib/git.py b/pagure/lib/git.py index 7328874..b72ad41 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -201,10 +201,7 @@ def _update_git(obj, repo, repofolder): diff = new_repo.diff() files = [] for patch in diff: - if hasattr(patch, 'new_file_path'): - files.append(patch.new_file_path) - elif hasattr(patch, 'delta'): - files.append(patch.delta.new_file.path) + files.append(patch.delta.new_file.path) # Add the changes to the index if added: @@ -905,9 +902,6 @@ def _update_file_in_git( diff = new_repo.diff() files = [] for patch in diff: - if hasattr(patch, 'new_file_path'): - files.append(patch.new_file_path) - elif hasattr(patch, 'delta'): files.append(patch.delta.new_file.path) # Add the changes to the index diff --git a/pagure/templates/commit.html b/pagure/templates/commit.html index c3c93ab..86be630 100644 --- a/pagure/templates/commit.html +++ b/pagure/templates/commit.html @@ -88,23 +88,10 @@ {% set filecount = 0 %} {% for patch in diff %} {% set filecount = filecount + 1 %} - {% if patch | hasattr('new_file_path') %} - - {{ patch.new_file_path | unicode}} - {% elif patch | hasattr('delta') %} {{ patch.delta.new_file.path | unicode }} - {% endif %}
{% if not patch.is_binary %} - {% if patch | hasattr('additions') %} - {% if (patch.additions + patch.deletions) %} - - {% if patch.additions > 0 %}+{{ patch.additions }}{% endif %} - {% if patch.deletions > 0 %}-{{ patch.deletions }}{% endif %} - - {% endif %} - {% else %} {% if (patch.line_stats[1] + patch.line_stats[2]) %} {% if patch.line_stats[1] > 0 %}+{{ patch.line_stats[1] }}{% endif %} @@ -112,7 +99,6 @@ {% endif %} {% endif %} - {% endif %}
{{ patch.new_file_path | unicode }}
@@ -162,30 +148,13 @@ {% set filecount = filecount + 1 %}
- {% if patch | hasattr('new_file_path') %} - - {{ patch.new_file_path | unicode }} - - {% elif patch | hasattr('delta') %} {{ patch.delta.new_file.path | unicode }} - {% endif %} {% if not patch.is_binary %} - {% if patch | hasattr('additions') %} - {% if (patch.additions + patch.deletions) %} - - {% if patch.additions > 0 %}+{{ patch.additions }} {% endif %} - {% if patch.deletions > 0 %}-{{ patch.deletions }}{% endif %} - - {% endif %} - {% else %} {% if (patch.line_stats[1] + patch.line_stats[2]) %} {% if patch.line_stats[1] > 0 %}+{{ patch.line_stats[1] }} {% endif %} @@ -193,7 +162,6 @@ {% endif %} {% endif %} - {% endif %}
{% if patch.is_binary %} diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index ad79d65..42d542a 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -382,15 +382,8 @@
- {% 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 %} + {% set linesadded = patch.line_stats[1] %} + {% set linesremoved = patch.line_stats[2] %} {% macro lineschanged(added, removed) -%} {%if added%} @@ -882,15 +875,8 @@ {% 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 %} + {% set linesadded = patch.line_stats[1] %} + {% set linesremoved = patch.line_stats[2] %} {% if patch | hasattr('new_file_path') %} {%- if patch.new_file_path == patch.old_file_path -%} {%- if patch.status == 'D' -%}