From a557419391ac68d96a7d0d9e455e42484bd77876 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 02 2015 10:49:54 +0000 Subject: Adjust pagure to make the tests pass on F23 with pygit 0.23.0 --- diff --git a/pagure/lib/git.py b/pagure/lib/git.py index e1277e9..1fd4554 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -190,7 +190,12 @@ def update_git(obj, repo, repofolder, objtype='ticket'): # Retrieve the list of files that changed diff = new_repo.diff() - files = [patch.new_file_path for patch in diff] + files = [] + for p in diff: + if hasattr(p, 'new_file_path'): + files.append(p.new_file_path) + elif hasattr(p, 'delta'): + files.append(p.delta.new_file.path) # Add the changes to the index if added: @@ -729,7 +734,12 @@ def update_file_in_git( # Retrieve the list of files that changed diff = new_repo.diff() - files = [patch.new_file_path for patch in diff] + files = [] + for p in diff: + if hasattr(p, 'new_file_path'): + files.append(p.new_file_path) + elif hasattr(p, 'delta'): + files.append(p.delta.new_file.path) # Add the changes to the index added = False diff --git a/pagure/templates/commit.html b/pagure/templates/commit.html index d8fa3d8..c2b48fa 100644 --- a/pagure/templates/commit.html +++ b/pagure/templates/commit.html @@ -66,11 +66,22 @@ {% for patch in diff %}
  • - {% if not patch.is_binary and (patch.additions + patch.deletions) > 0%} - - {% if patch.additions > 0 %}+{{ patch.additions }}{% endif %} - {% if patch.deletions > 0 %}-{{ patch.deletions }}{% 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 %} + {% if patch.line_stats[2] > 0 %}-{{ patch.line_stats[2] }}{% endif %} + + {% endif %} + {% endif %} {% endif %} {{ patch.new_file_path }} @@ -84,15 +95,30 @@ {% for patch in diff %}
    + {% if patch | hasattr('new_file_path') %}

    {{ patch.new_file_path }}

    + {% elif patch | hasattr('delta') %} +

    {{ patch.delta.new_file.path }}

    + {% endif %}