#3051 APIs of pygit2 in epel and fedora are now compatible
Merged 6 years ago by pingou. Opened 6 years ago by cverna.
cverna/pagure cleanup_pygit2  into  master

file modified
+2 -2
@@ -29,7 +29,7 @@ 

  BuildRequires:      python-flask-multistatic

  BuildRequires:      python-markdown

  BuildRequires:      python-psutil

- BuildRequires:      python-pygit2 >= 0.20.1

+ BuildRequires:      python-pygit2 >= 0.22.1

  BuildRequires:      python-pygments

  BuildRequires:      python-fedora

  BuildRequires:      python-openid
@@ -61,7 +61,7 @@ 

  Requires:           python-flask-multistatic

  Requires:           python-markdown

  Requires:           python-psutil

- Requires:           python-pygit2 >= 0.20.1

+ Requires:           python-pygit2 >= 0.22.1

  Requires:           python-pygments

  Requires:           python-fedora

  Requires:           python-openid

file modified
+2 -8
@@ -201,10 +201,7 @@ 

      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,10 +902,7 @@ 

      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

      added = False

@@ -88,23 +88,10 @@ 

    {% set filecount = 0 %}

    {% for patch in diff %}

        {% set filecount = filecount + 1 %}

-       {% if patch | hasattr('new_file_path') %}

-         <a class="list-group-item" href="#diff-file-{{filecount}}">

-           {{  patch.new_file_path | unicode}}

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

          <a class="list-group-item" href="#diff-file-{{filecount}}">

            {{  patch.delta.new_file.path | unicode }}

-       {% endif %}

        <div class="pull-xs-right">

          {% if not patch.is_binary  %}

-         {% if patch | hasattr('additions') %}

-         {% if (patch.additions + patch.deletions) %}

-           <span style="width: {{ (100.0 * patch.additions / (patch.additions + patch.deletions))|round|int }}%">

-             {% if patch.additions > 0 %}<span class="label label-success">+{{ patch.additions }}</span>{% endif %}

-             {% if patch.deletions > 0 %}<span class="label label-danger">-{{ patch.deletions }}</span>{% endif %}

-           </span>

-         {% endif %}

-         {% else %}

          {% if (patch.line_stats[1] + patch.line_stats[2]) %}

            <span style="width: {{ (100.0 * patch.line_stats[1] / (patch.line_stats[1] + patch.line_stats[2]))|round|int }}%">

              {% if patch.line_stats[1] > 0 %}<span class="label label-success">+{{ patch.line_stats[1] }}</span>{% endif %}
@@ -112,7 +99,6 @@ 

            </span>

          {% endif %}

          {% endif %}

-         {% endif %}

        </div>

        {{ patch.new_file_path | unicode }}

      </a>
@@ -162,30 +148,13 @@ 

    {% set filecount = filecount + 1 %}

  <div class="card" id="diff-file-{{filecount}}">

    <div class="card-header">

-     {% if patch | hasattr('new_file_path') %}

-       <a href="{{ url_for(

-           'ui_ns.view_file', username=username, namespace=repo.namespace,

-           repo=repo.name, identifier=commitid,

-           filename=patch.new_file_path) }}" title="View file as of {{ commitid|short }}">

-         {{  patch.new_file_path | unicode }}

-       </a>

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

        <a href="{{ url_for(

            'ui_ns.view_file', username=username, namespace=repo.namespace,

            repo=repo.name, identifier=commitid,

            filename=patch.delta.new_file.path) }}" title="View file as of {{ commitid|short }}">

          {{  patch.delta.new_file.path | unicode }}

        </a>

-     {% endif %}

          {% if not patch.is_binary  %}

-           {% if patch | hasattr('additions') %}

-           {% if (patch.additions + patch.deletions) %}

-             <span style="width: {{ (100.0 * patch.additions / (patch.additions + patch.deletions))|round|int }}%">

-               {% if patch.additions > 0 %}<span class="label label-success">+{{ patch.additions }}</span> {% endif %}

-               {% if patch.deletions > 0 %}<span class="label label-danger">-{{ patch.deletions }}</span>{% endif %}

-             </span>

-           {% endif %}

-           {% else %}

            {% if (patch.line_stats[1] + patch.line_stats[2]) %}

              <span style="width: {{ (100.0 * patch.line_stats[1] / (patch.line_stats[1] + patch.line_stats[2]))|round|int }}%">

                {% if patch.line_stats[1] > 0 %}<span class="label label-success">+{{ patch.line_stats[1] }}</span> {% endif %}
@@ -193,7 +162,6 @@ 

              </span>

            {% endif %}

            {% endif %}

-           {% endif %}

    </div>

  

      {% if patch.is_binary %}

@@ -382,15 +382,8 @@ 

          <div class="card-header">

              <h5>

  

-               {% 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 %}

          <div class="list-group-item">

-           {% 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' -%}

file modified
+1 -1
@@ -18,7 +18,7 @@ 

  munch

  Pillow

  psutil

- pygit2 >= 0.20.1

+ pygit2 >= 0.22.1

  pygments

  python-openid

  python-openid-cla

The version pygit2 in epel (0.24.2) is recent enough
to drop all conditional check we had in place

Signed-off-by: Clement Verna cverna@tutanota.com

Ok, but then let's be explicit about the minimal pygit2 version supported. This would need to be in the requirements.txt, the spec file and the documentation somewhere :)

rebased onto 170c096cdd25ba8ffc3ab4682cb7378166f2e105

6 years ago

The installation documentation reference rpm install and pip install and both method have the pygit2 version required defined.

1 new commit added

  • Fix indentation
6 years ago

rebased onto 87528807e4095eb1a24e58a97fd933f03891f3dd

6 years ago

rebased onto 9c9f3ae

6 years ago

Pull-Request has been merged by pingou

6 years ago