Hello community,

here is the log from the commit of package python-pygit2 for openSUSE:Factory 
checked in at 2017-05-06 18:26:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pygit2 (Old)
 and      /work/SRC/openSUSE:Factory/.python-pygit2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pygit2"

Sat May  6 18:26:51 2017 rev:14 rq:486850 version:0.25.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pygit2/python-pygit2.changes      
2017-01-23 11:34:54.367011791 +0100
+++ /work/SRC/openSUSE:Factory/.python-pygit2.new/python-pygit2.changes 
2017-05-06 18:26:54.634432444 +0200
@@ -1,0 +2,10 @@
+Fri Apr  7 22:12:04 UTC 2017 - toddrme2...@gmail.com
+
+- Update to 0.25.0.
+  * Make pygit2 throw if tree of a commit is not found
+  * fixed cached memory tests
+  *  Added mwindow_mapped_limit, cached_memory, enable_caching, 
+     cache_max_size, cache_object_limit options
+- Implement singlespec version.
+
+-------------------------------------------------------------------

Old:
----
  pygit2-0.24.2.tar.gz

New:
----
  pygit2-0.25.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pygit2.spec ++++++
--- /var/tmp/diff_new_pack.C0vXyE/_old  2017-05-06 18:26:55.294339328 +0200
+++ /var/tmp/diff_new_pack.C0vXyE/_new  2017-05-06 18:26:55.298338763 +0200
@@ -16,43 +16,47 @@
 #
 
 
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pygit2
-Version:        0.24.2
+Version:        0.25.0
 Release:        0
 Summary:        Python bindings for libgit2
 License:        GPL-2.0
 Group:          Development/Languages/Python
 Url:            https://github.com/libgit2/pygit2
 Source:         
https://pypi.io/packages/source/p/pygit2/pygit2-%{version}.tar.gz
-BuildRequires:  libgit2-devel >= 0.24
-#BuildRequires:  python-unittest2
+BuildRequires:  libgit2-devel >= 0.25
 BuildRequires:  libopenssl-devel
-BuildRequires:  python-cffi
-BuildRequires:  python-devel
-BuildRequires:  python-setuptools
-BuildRequires:  python-six
+BuildRequires:  fdupes
+BuildRequires:  python-rpm-macros
+BuildRequires:  %{python_module cffi}
+BuildRequires:  %{python_module devel}
+BuildRequires:  %{python_module six}
+BuildRequires:  %{python_module setuptools}
 %requires_eq    python-cffi
+Requires:       python-six
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
+%python_subpackages
+
 %description
 Bindings for libgit2, a linkable C library for the Git version-control system.
 
 %prep
 %setup -q -n pygit2-%{version}
-# Adjust include/lib paths to local system
-#sed -i 's|/usr/local/include|%%{_includedir}|' setup.py
-#sed -i 's|/usr/local/lib|%%{_libdir}|' setup.py
 
 %build
-CFLAGS="%{optflags} -fno-strict-aliasing" python setup.py build
+export CFLAGS="%{optflags} -fno-strict-aliasing"
+%python_build
 
 %install
-python setup.py install --prefix=%{_prefix} --root=%{buildroot}
+%python_install
+%python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
 #python setup.py test
 
-%files
+%files %{python_files}
 %defattr(-,root,root,-)
 %doc COPYING README.rst
 %{python_sitearch}/*

++++++ pygit2-0.24.2.tar.gz -> pygit2-0.25.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/PKG-INFO new/pygit2-0.25.0/PKG-INFO
--- old/pygit2-0.24.2/PKG-INFO  2016-11-01 21:00:31.000000000 +0100
+++ new/pygit2-0.25.0/PKG-INFO  2016-12-26 12:34:48.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pygit2
-Version: 0.24.2
+Version: 0.25.0
 Summary: Python bindings for libgit2.
 Home-page: http://github.com/libgit2/pygit2
 Author: J. David Ibáñez
@@ -36,6 +36,20 @@
         Changelog
         ==============
         
+        0.25.0 (2016-12-26)
+        -------------------------
+        
+        - Upgrade to libgit2 0.25
+          `#670 <https://github.com/libgit2/pygit2/pull/670>`_
+        
+        - Now Commit.tree raises an error if tree is not found
+          `#682 <https://github.com/libgit2/pygit2/pull/682>`_
+        
+        - New settings.mwindow_mapped_limit, cached_memory, enable_caching,
+          cache_max_size and cache_object_limit
+          `#677 <https://github.com/libgit2/pygit2/pull/677>`_
+        
+        
         0.24.2 (2016-11-01)
         -------------------------
         
@@ -842,30 +856,30 @@
           Brodie Rao                John Szakmeister          Vlad Temian
           Nicolas Dandrimont        David Versmisse           Rémi Duraffort
           Santiago Perez De Rosso   Sebastian Thiel           Thom Wiggers
-          Alok Singhal              Fraser Tweedale           Han-Wen Nienhuys
-          Leonardo Rhodes           Petr Viktorin             Ron Cohen
-          Thomas Kluyver            anatoly techtonik         Alex Chamberlain
-          Alexander Bayandin        Amit Bakshi               Andrey Devyatkin
-          Arno van Lumig            Ben Davis                 Dustin Raimondi
-          Eric Schrijver            Greg Fitzgerald           Hervé Cauwelier
-          Huang Huang               Ian P. McCullough         Igor Gnatenko
-          Jack O'Connor             Jared Flatow              Jiunn Haur Lim
-          Jun Omae                  Kaarel Kitsemets          Kevin KIN-FOO
-          Masud Rahman              Michael Sondergaard       Ondřej Nový
-          Sarath Lakshman           Vicent Marti              Zoran Zaric
-          mrh1997                   Adam Spiers               Andrew Chin
-          András Veres-Szentkirályi Ash Berlin                Benjamin Kircher
-          Benjamin Pollack          Bryan O'Sullivan          Cam Cope
-          Chason Chaffin            Chris Rebert              Colin Watson
-          Daniel Bruce              David Fischer             David Sanders
-          David Six                 Devaev Maxim              Eric Davis
-          Erik Meusel               Erik van Zijst            Ferengee
-          Guille -bisho-            Gustavo Di Pietro         Holger Frey
-          Hugh Cole-Baker           Jasper Lievisse Adriaanse Josh Bleecher 
Snyder
-          Justin Clift              Kyriakos Oikonomakos      Lukas Fleischer
-          Mathieu Bridon            Nicolás Sanguinetti       Noah Fontes
-          Óscar San José            Peter Dave Hello          Philippe 
Ombredanne
-          Ridge Kennedy             Robert Hölzl              Ross Nicoll
+          Alok Singhal              Anatoly Techtonik         Fraser Tweedale
+          Han-Wen Nienhuys          Leonardo Rhodes           Petr Viktorin
+          Robert Hölzl              Ron Cohen                 Thomas Kluyver
+          Alex Chamberlain          Alexander Bayandin        Amit Bakshi
+          Andrey Devyatkin          Arno van Lumig            Ben Davis
+          Dustin Raimondi           Eric Schrijver            Greg Fitzgerald
+          Guillermo Pérez           Hervé Cauwelier           Huang Huang
+          Ian P. McCullough         Igor Gnatenko             Jack O'Connor
+          Jared Flatow              Jiunn Haur Lim            Jun Omae
+          Kaarel Kitsemets          Kevin KIN-FOO             Masud Rahman
+          Michael Sondergaard       Ondřej Nový               Sarath Lakshman
+          Szucs Krisztian           Vicent Marti              Zoran Zaric
+          Adam Spiers               Andrew Chin               András 
Veres-Szentkirályi
+          Ash Berlin                Benjamin Kircher          Benjamin Pollack
+          Bryan O'Sullivan          Cam Cope                  Chason Chaffin
+          Chris Rebert              Colin Watson              Daniel Bruce
+          David Fischer             David Sanders             David Six
+          Devaev Maxim              Eric Davis                Erik Meusel
+          Erik van Zijst            Ferengee                  Gustavo Di Pietro
+          Holger Frey               Hugh Cole-Baker           Jasper Lievisse 
Adriaanse
+          Josh Bleecher Snyder      Justin Clift              Kyriakos 
Oikonomakos
+          Lukas Fleischer           Mathieu Bridon            Nicolás 
Sanguinetti
+          Noah Fontes               Óscar San José            Peter Dave Hello
+          Philippe Ombredanne       Ridge Kennedy             Ross Nicoll
           Rui Abreu Ferreira        Sheeo                     Soasme
           Vladimir Rutsky           Yu Jianjian               chengyuhang
           earl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/README.rst new/pygit2-0.25.0/README.rst
--- old/pygit2-0.24.2/README.rst        2016-11-01 20:26:59.000000000 +0100
+++ new/pygit2-0.25.0/README.rst        2016-12-26 12:29:47.000000000 +0100
@@ -28,6 +28,20 @@
 Changelog
 ==============
 
+0.25.0 (2016-12-26)
+-------------------------
+
+- Upgrade to libgit2 0.25
+  `#670 <https://github.com/libgit2/pygit2/pull/670>`_
+
+- Now Commit.tree raises an error if tree is not found
+  `#682 <https://github.com/libgit2/pygit2/pull/682>`_
+
+- New settings.mwindow_mapped_limit, cached_memory, enable_caching,
+  cache_max_size and cache_object_limit
+  `#677 <https://github.com/libgit2/pygit2/pull/677>`_
+
+
 0.24.2 (2016-11-01)
 -------------------------
 
@@ -834,30 +848,30 @@
   Brodie Rao                John Szakmeister          Vlad Temian
   Nicolas Dandrimont        David Versmisse           Rémi Duraffort
   Santiago Perez De Rosso   Sebastian Thiel           Thom Wiggers
-  Alok Singhal              Fraser Tweedale           Han-Wen Nienhuys
-  Leonardo Rhodes           Petr Viktorin             Ron Cohen
-  Thomas Kluyver            anatoly techtonik         Alex Chamberlain
-  Alexander Bayandin        Amit Bakshi               Andrey Devyatkin
-  Arno van Lumig            Ben Davis                 Dustin Raimondi
-  Eric Schrijver            Greg Fitzgerald           Hervé Cauwelier
-  Huang Huang               Ian P. McCullough         Igor Gnatenko
-  Jack O'Connor             Jared Flatow              Jiunn Haur Lim
-  Jun Omae                  Kaarel Kitsemets          Kevin KIN-FOO
-  Masud Rahman              Michael Sondergaard       Ondřej Nový
-  Sarath Lakshman           Vicent Marti              Zoran Zaric
-  mrh1997                   Adam Spiers               Andrew Chin
-  András Veres-Szentkirályi Ash Berlin                Benjamin Kircher
-  Benjamin Pollack          Bryan O'Sullivan          Cam Cope
-  Chason Chaffin            Chris Rebert              Colin Watson
-  Daniel Bruce              David Fischer             David Sanders
-  David Six                 Devaev Maxim              Eric Davis
-  Erik Meusel               Erik van Zijst            Ferengee
-  Guille -bisho-            Gustavo Di Pietro         Holger Frey
-  Hugh Cole-Baker           Jasper Lievisse Adriaanse Josh Bleecher Snyder
-  Justin Clift              Kyriakos Oikonomakos      Lukas Fleischer
-  Mathieu Bridon            Nicolás Sanguinetti       Noah Fontes
-  Óscar San José            Peter Dave Hello          Philippe Ombredanne
-  Ridge Kennedy             Robert Hölzl              Ross Nicoll
+  Alok Singhal              Anatoly Techtonik         Fraser Tweedale
+  Han-Wen Nienhuys          Leonardo Rhodes           Petr Viktorin
+  Robert Hölzl              Ron Cohen                 Thomas Kluyver
+  Alex Chamberlain          Alexander Bayandin        Amit Bakshi
+  Andrey Devyatkin          Arno van Lumig            Ben Davis
+  Dustin Raimondi           Eric Schrijver            Greg Fitzgerald
+  Guillermo Pérez           Hervé Cauwelier           Huang Huang
+  Ian P. McCullough         Igor Gnatenko             Jack O'Connor
+  Jared Flatow              Jiunn Haur Lim            Jun Omae
+  Kaarel Kitsemets          Kevin KIN-FOO             Masud Rahman
+  Michael Sondergaard       Ondřej Nový               Sarath Lakshman
+  Szucs Krisztian           Vicent Marti              Zoran Zaric
+  Adam Spiers               Andrew Chin               András Veres-Szentkirályi
+  Ash Berlin                Benjamin Kircher          Benjamin Pollack
+  Bryan O'Sullivan          Cam Cope                  Chason Chaffin
+  Chris Rebert              Colin Watson              Daniel Bruce
+  David Fischer             David Sanders             David Six
+  Devaev Maxim              Eric Davis                Erik Meusel
+  Erik van Zijst            Ferengee                  Gustavo Di Pietro
+  Holger Frey               Hugh Cole-Baker           Jasper Lievisse Adriaanse
+  Josh Bleecher Snyder      Justin Clift              Kyriakos Oikonomakos
+  Lukas Fleischer           Mathieu Bridon            Nicolás Sanguinetti
+  Noah Fontes               Óscar San José            Peter Dave Hello
+  Philippe Ombredanne       Ridge Kennedy             Ross Nicoll
   Rui Abreu Ferreira        Sheeo                     Soasme
   Vladimir Rutsky           Yu Jianjian               chengyuhang
   earl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/appveyor.yml 
new/pygit2-0.25.0/appveyor.yml
--- old/pygit2-0.24.2/appveyor.yml      2016-11-01 13:41:23.000000000 +0100
+++ new/pygit2-0.25.0/appveyor.yml      2016-12-23 21:37:58.000000000 +0100
@@ -25,7 +25,7 @@
 build_script:
 - cmd: |
     set LIBGIT2=%APPVEYOR_BUILD_FOLDER%\build\libgit2
-    git clone --depth=1 -b maint/v0.24 https://github.com/libgit2/libgit2.git 
libgit2
+    git clone --depth=1 -b maint/v0.25 https://github.com/libgit2/libgit2.git 
libgit2
     mkdir build
     
     cd build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/docs/conf.py 
new/pygit2-0.25.0/docs/conf.py
--- old/pygit2-0.24.2/docs/conf.py      2016-11-01 20:28:45.000000000 +0100
+++ new/pygit2-0.25.0/docs/conf.py      2016-12-26 11:53:40.000000000 +0100
@@ -50,9 +50,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = '0.24'
+version = '0.25'
 # The full version, including alpha/beta/rc tags.
-release = '0.24.2'
+release = '0.25.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/docs/general.rst 
new/pygit2-0.25.0/docs/general.rst
--- old/pygit2-0.24.2/docs/general.rst  2016-11-01 20:29:47.000000000 +0100
+++ new/pygit2-0.25.0/docs/general.rst  2016-12-26 11:54:44.000000000 +0100
@@ -18,7 +18,7 @@
 .. py:data:: LIBGIT2_VER_MAJOR
 
    Integer value of the major version number. For example, for the version
-   ``0.24.2``::
+   ``0.25.0``::
 
       >>> print LIBGIT2_VER_MAJOR
       0
@@ -26,25 +26,25 @@
 .. py:data:: LIBGIT2_VER_MINOR
 
    Integer value of the minor version number. For example, for the version
-   ``0.24.2``::
+   ``0.25.0``::
 
       >>> print LIBGIT2_VER_MINOR
-      24
+      25
 
 .. py:data:: LIBGIT2_VER_REVISION
 
    Integer value of the revision version number. For example, for the version
-   ``0.24.2``::
+   ``0.25.0``::
 
       >>> print LIBGIT2_VER_REVISION
-      2
+      0
 
 .. py:data:: LIBGIT2_VERSION
 
    The libgit2 version number as a string::
 
       >>> print LIBGIT2_VERSION
-      '0.24.2'
+      '0.25.0'
 
 Errors
 ======
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/docs/install.rst 
new/pygit2-0.25.0/docs/install.rst
--- old/pygit2-0.24.2/docs/install.rst  2016-11-01 20:30:42.000000000 +0100
+++ new/pygit2-0.25.0/docs/install.rst  2016-12-23 21:37:58.000000000 +0100
@@ -14,7 +14,7 @@
 ============
 
 - Python 2.7, 3.2+ or PyPy 2.6+ (including the development headers)
-- Libgit2 v0.23.x
+- Libgit2 v0.25.x
 - cffi 1.0+
 - six
 - tox (optional)
@@ -43,11 +43,11 @@
 
 As illustration see this table of compatible releases:
 
-+-----------+-----------------------+----------------------------------------+
-|**libgit2**| 0.24.0, 0.24.1 0.24.2 | 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4 |
-+-----------+-----------------------+----------------------------------------+
-|**pygit2** | 0.24.0, 0.24.1 0.24.2 | 0.23.0, 0.23.1, 0.23.2, 0.23.3         |
-+-----------+-----------------------+----------------------------------------+
++-----------+--------+--------------+--------+
+|**libgit2**| 0.25.0 | 0.24.0, 0.24.1 0.24.2 |
++-----------+--------+--------------+--------+
+|**pygit2** | 0.25.0 | 0.24.0, 0.24.1 0.24.2 |
++-----------+--------+--------------+--------+
 
 .. warning::
 
@@ -64,9 +64,9 @@
 
 .. code-block:: sh
 
-   $ wget https://github.com/libgit2/libgit2/archive/v0.24.2.tar.gz
-   $ tar xzf v0.24.2.tar.gz
-   $ cd libgit2-0.24.2/
+   $ wget https://github.com/libgit2/libgit2/archive/v0.25.0.tar.gz
+   $ tar xzf v0.25.0.tar.gz
+   $ cd libgit2-0.25.0/
    $ cmake .
    $ make
    $ sudo make install
@@ -148,9 +148,9 @@
 
 .. code-block:: sh
 
-   $ wget https://github.com/libgit2/libgit2/archive/v0.23.4.tar.gz
-   $ tar xzf v0.23.4.tar.gz
-   $ cd libgit2-0.23.4/
+   $ wget https://github.com/libgit2/libgit2/archive/v0.25.0.tar.gz
+   $ tar xzf v0.25.0.tar.gz
+   $ cd libgit2-0.25.0/
    $ cmake . -DCMAKE_INSTALL_PREFIX=$LIBGIT2
    $ make
    $ make install
@@ -186,7 +186,7 @@
 
 .. code-block:: sh
 
-   $ readelf --dynamic 
lib/python2.7/site-packages/pygit2-0.23.0-py2.7-linux-x86_64.egg/_pygit2.so | 
grep PATH
+   $ readelf --dynamic 
lib/python2.7/site-packages/pygit2-0.25.0-py2.7-linux-x86_64.egg/_pygit2.so | 
grep PATH
     0x000000000000001d (RUNPATH)            Library runpath: [/tmp/venv/lib]
 
 
@@ -203,9 +203,9 @@
 .. code-block:: sh
 
    $ export LIBGIT2=C:/Dev/libgit2
-   $ wget https://github.com/libgit2/libgit2/archive/v0.23.4.tar.gz
-   $ tar xzf v0.23.4.tar.gz
-   $ cd libgit2-0.23.4/
+   $ wget https://github.com/libgit2/libgit2/archive/v0.25.0.tar.gz
+   $ tar xzf v0.25.0.tar.gz
+   $ cd libgit2-0.25.0/
    $ cmake . -DSTDCALL=OFF -DCMAKE_INSTALL_PREFIX=$LIBGIT2 -G "Visual Studio 9 
2008"
    $ cmake --build . --config release --target install
    $ ctest -v
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/pygit2/_build.py 
new/pygit2-0.25.0/pygit2/_build.py
--- old/pygit2-0.24.2/pygit2/_build.py  2016-11-01 20:28:59.000000000 +0100
+++ new/pygit2-0.25.0/pygit2/_build.py  2016-12-26 11:53:22.000000000 +0100
@@ -37,7 +37,7 @@
 #
 # The version number of pygit2
 #
-__version__ = '0.24.2'
+__version__ = '0.25.0'
 
 
 #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/pygit2/decl.h 
new/pygit2-0.25.0/pygit2/decl.h
--- old/pygit2-0.24.2/pygit2/decl.h     2016-03-05 23:21:33.000000000 +0100
+++ new/pygit2-0.25.0/pygit2/decl.h     2016-12-23 21:37:58.000000000 +0100
@@ -207,11 +207,30 @@
 
 typedef struct git_remote_callbacks git_remote_callbacks;
 
+typedef enum {
+       GIT_PROXY_NONE,
+       GIT_PROXY_AUTO,
+       GIT_PROXY_SPECIFIED,
+} git_proxy_t;
+
+typedef struct {
+       unsigned int version;
+       git_proxy_t type;
+       const char *url;
+       git_cred_acquire_cb credentials;
+        git_transport_certificate_check_cb certificate_check;
+       void *payload;
+} git_proxy_options;
+
+#define GIT_PROXY_OPTIONS_VERSION ...
+int git_proxy_init_options(git_proxy_options *opts, unsigned int version);
+
 typedef struct {
        unsigned int version;
        unsigned int pb_parallelism;
        git_remote_callbacks callbacks;
-    git_strarray custom_headers;
+       git_proxy_options proxy_opts;
+       git_strarray custom_headers;
 } git_push_options;
 
 #define GIT_PUSH_OPTIONS_VERSION ...
@@ -236,7 +255,8 @@
        git_fetch_prune_t prune;
        int update_fetchhead;
        git_remote_autotag_option_t download_tags;
-    git_strarray custom_headers;
+       git_proxy_options proxy_opts;
+       git_strarray custom_headers;
 } git_fetch_options;
 
 #define GIT_FETCH_OPTIONS_VERSION ...
@@ -738,7 +758,8 @@
        unsigned int rename_threshold;
        unsigned int target_limit;
        git_diff_similarity_metric *metric;
-    unsigned int recursion_limit;
+       unsigned int recursion_limit;
+       const char *default_driver;
        git_merge_file_favor_t file_favor;
        unsigned int file_flags;
 } git_merge_options;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/pygit2/settings.py 
new/pygit2-0.25.0/pygit2/settings.py
--- old/pygit2-0.24.2/pygit2/settings.py        2015-10-25 13:02:52.000000000 
+0100
+++ new/pygit2-0.25.0/pygit2/settings.py        2016-12-03 17:13:03.000000000 
+0100
@@ -28,6 +28,11 @@
 from _pygit2 import option
 from _pygit2 import GIT_OPT_GET_SEARCH_PATH, GIT_OPT_SET_SEARCH_PATH
 from _pygit2 import GIT_OPT_GET_MWINDOW_SIZE, GIT_OPT_SET_MWINDOW_SIZE
+from _pygit2 import GIT_OPT_GET_MWINDOW_MAPPED_LIMIT, 
GIT_OPT_SET_MWINDOW_MAPPED_LIMIT
+from _pygit2 import GIT_OPT_SET_CACHE_OBJECT_LIMIT
+from _pygit2 import GIT_OPT_GET_CACHED_MEMORY
+from _pygit2 import GIT_OPT_ENABLE_CACHING
+from _pygit2 import GIT_OPT_SET_CACHE_MAX_SIZE
 
 
 class SearchPathList(object):
@@ -64,3 +69,36 @@
     @mwindow_size.setter
     def mwindow_size(self, value):
         option(GIT_OPT_SET_MWINDOW_SIZE, value)
+
+    @property
+    def mwindow_mapped_limit(self):
+        """Mwindow mapped limit"""
+        return option(GIT_OPT_GET_MWINDOW_MAPPED_LIMIT)
+
+    @mwindow_mapped_limit.setter
+    def mwindow_mapped_limit(self, value):
+        """Mwindow mapped limit"""
+        return option(GIT_OPT_SET_MWINDOW_MAPPED_LIMIT, value)
+
+    @property
+    def cached_memory(self):
+        """Maximum mmap window size"""
+        return option(GIT_OPT_GET_CACHED_MEMORY)
+
+    def enable_caching(self, value=True):
+        return option(GIT_OPT_ENABLE_CACHING, value)
+
+    def cache_max_size(self, value):
+        return option(GIT_OPT_SET_CACHE_MAX_SIZE, value)
+
+    def cache_object_limit(self, object_type, value):
+        """Set the maximum data size for the given type of object to be
+           considered eligible for caching in memory.
+
+        Setting to value to zero means that that type of object will not
+        be cached. Defaults to 0 for GIT_OBJ_BLOB (i.e. won't cache
+        blobs) and 4k for GIT_OBJ_COMMIT, GIT_OBJ_TREE, and GIT_OBJ_TAG.
+        """
+        return option(GIT_OPT_SET_CACHE_OBJECT_LIMIT, object_type, value)
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/src/commit.c 
new/pygit2-0.25.0/src/commit.c
--- old/pygit2-0.24.2/src/commit.c      2015-10-25 13:02:52.000000000 +0100
+++ new/pygit2-0.25.0/src/commit.c      2016-12-20 20:02:47.000000000 +0100
@@ -35,6 +35,7 @@
 #include "oid.h"
 
 extern PyTypeObject TreeType;
+extern PyObject *GitError;
 
 
 PyDoc_STRVAR(Commit_message_encoding__doc__, "Message encoding.");
@@ -131,8 +132,11 @@
     int err;
 
     err = git_commit_tree(&tree, commit->commit);
-    if (err == GIT_ENOTFOUND)
-        Py_RETURN_NONE;
+    if (err == GIT_ENOTFOUND) {
+        char tree_id[GIT_OID_HEXSZ + 1] = { 0 };
+        git_oid_fmt(tree_id, git_commit_tree_id(commit->commit));
+        return PyErr_Format(GitError, "Unable to read tree %s", tree_id);
+    }
 
     if (err < 0)
         return Error_set(err);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/src/options.c 
new/pygit2-0.25.0/src/options.c
--- old/pygit2-0.24.2/src/options.c     2015-10-25 13:02:52.000000000 +0100
+++ new/pygit2-0.25.0/src/options.c     2016-12-03 17:13:03.000000000 +0100
@@ -156,6 +156,138 @@
             Py_RETURN_NONE;
             break;
         }
+
+        case GIT_OPT_GET_MWINDOW_MAPPED_LIMIT:
+        {
+            size_t limit;
+
+            error = git_libgit2_opts(GIT_OPT_GET_MWINDOW_MAPPED_LIMIT, &limit);
+            if (error < 0) {
+                Error_set(error);
+                return NULL;
+            }
+
+            return PyLong_FromSize_t(limit);
+
+            break;
+        }
+
+        case GIT_OPT_SET_MWINDOW_MAPPED_LIMIT:
+        {
+            size_t limit;
+            PyObject *py_limit;
+
+            py_limit = PyTuple_GetItem(args, 1);
+            if (!py_limit)
+                return NULL;
+
+            if (!PyLong_Check(py_limit))
+                goto on_non_integer;
+
+            limit = PyLong_AsSize_t(py_limit);
+            error = git_libgit2_opts(GIT_OPT_SET_MWINDOW_MAPPED_LIMIT, limit);
+            if (error  < 0) {
+                Error_set(error);
+                return NULL;
+            }
+
+            Py_RETURN_NONE;
+            break;
+        }
+
+        case GIT_OPT_SET_CACHE_OBJECT_LIMIT:
+        {
+            size_t limit;
+            int object_type;
+            PyObject *py_object_type, *py_limit;
+
+            py_object_type = PyTuple_GetItem(args, 1);
+            if (!py_object_type)
+                return NULL;
+
+            py_limit = PyTuple_GetItem(args, 2);
+            if (!py_limit)
+                return NULL;
+
+            if (!PyLong_Check(py_limit))
+                goto on_non_integer;
+
+            object_type = PyLong_AsLong(py_object_type);
+            limit = PyLong_AsSize_t(py_limit);
+            error = git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, 
object_type, limit);
+
+            if (error < 0) {
+                Error_set(error);
+                return NULL;
+            }
+
+            Py_RETURN_NONE;
+            break;
+        }
+
+        case GIT_OPT_SET_CACHE_MAX_SIZE:
+        {
+          size_t max_size;
+          PyObject *py_max_size;
+
+          py_max_size = PyTuple_GetItem(args, 1);
+          if (!py_max_size)
+              return NULL;
+
+          if (!PyLong_Check(py_max_size))
+              goto on_non_integer;
+
+          max_size = PyLong_AsSize_t(py_max_size);
+          error = git_libgit2_opts(GIT_OPT_SET_CACHE_MAX_SIZE, max_size);
+          if (error  < 0) {
+              Error_set(error);
+              return NULL;
+          }
+
+          Py_RETURN_NONE;
+          break;
+        }
+
+        case GIT_OPT_ENABLE_CACHING:
+        {
+            int flag;
+            PyObject *py_flag;
+
+            py_flag = PyTuple_GetItem(args, 1);
+
+            if (!PyLong_Check(py_flag))
+                goto on_non_integer;
+
+            flag = PyLong_AsSize_t(py_flag);
+            error = git_libgit2_opts(GIT_OPT_ENABLE_CACHING, flag);
+            if (error  < 0) {
+                Error_set(error);
+                return NULL;
+            }
+
+            Py_RETURN_NONE;
+            break;
+        }
+
+        case GIT_OPT_GET_CACHED_MEMORY:
+        {
+            size_t current;
+            size_t allowed;
+            PyObject* tup = PyTuple_New(2);
+
+            error = git_libgit2_opts(GIT_OPT_GET_CACHED_MEMORY, &current, 
&allowed);
+            if (error < 0) {
+                Error_set(error);
+                return NULL;
+            }
+            PyTuple_SetItem(tup, 0, PyLong_FromLong(current));
+            PyTuple_SetItem(tup, 1, PyLong_FromLong(allowed));
+
+            return tup;
+
+            break;
+        }
+
     }
 
     PyErr_SetString(PyExc_ValueError, "unknown/unsupported option value");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/src/pygit2.c 
new/pygit2-0.25.0/src/pygit2.c
--- old/pygit2-0.24.2/src/pygit2.c      2015-12-07 12:19:18.000000000 +0100
+++ new/pygit2-0.25.0/src/pygit2.c      2016-12-03 17:13:03.000000000 +0100
@@ -170,6 +170,12 @@
     ADD_CONSTANT_INT(m, GIT_OPT_SET_SEARCH_PATH);
     ADD_CONSTANT_INT(m, GIT_OPT_GET_MWINDOW_SIZE);
     ADD_CONSTANT_INT(m, GIT_OPT_SET_MWINDOW_SIZE);
+    ADD_CONSTANT_INT(m, GIT_OPT_GET_MWINDOW_MAPPED_LIMIT);
+    ADD_CONSTANT_INT(m, GIT_OPT_SET_MWINDOW_MAPPED_LIMIT);
+    ADD_CONSTANT_INT(m, GIT_OPT_SET_CACHE_OBJECT_LIMIT);
+    ADD_CONSTANT_INT(m, GIT_OPT_GET_CACHED_MEMORY);
+    ADD_CONSTANT_INT(m, GIT_OPT_ENABLE_CACHING);
+    ADD_CONSTANT_INT(m, GIT_OPT_SET_CACHE_MAX_SIZE);
 
     /* Errors */
     GitError = PyErr_NewException("_pygit2.GitError", NULL, NULL);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/src/repository.c 
new/pygit2-0.25.0/src/repository.c
--- old/pygit2-0.24.2/src/repository.c  2016-06-02 16:18:07.000000000 +0200
+++ new/pygit2-0.25.0/src/repository.c  2016-12-23 21:37:58.000000000 +0100
@@ -862,38 +862,17 @@
 }
 
 
+#define BUFSIZE 4096
+
 PyDoc_STRVAR(Repository_create_blob_fromiobase__doc__,
     "create_blob_fromiobase(io.IOBase) -> Oid\n"
     "\n"
     "Create a new blob from an IOBase object.");
 
-
-int read_chunk(char *content, size_t max_length, void *payload)
-{
-    PyObject   *py_file;
-    PyObject   *py_bytes;
-    char       *bytes;
-    Py_ssize_t  size;
-
-    py_file  = (PyObject *)payload;
-    py_bytes = PyObject_CallMethod(py_file, "read", "i", max_length);
-    if (!py_bytes)
-        return -1;
-
-    size = 0;
-    if (py_bytes != Py_None) {
-        bytes = PyBytes_AsString(py_bytes);
-        size  = PyBytes_Size(py_bytes);
-        memcpy(content, bytes, size);
-    }
-
-    Py_DECREF(py_bytes);
-    return size;
-}
-
 PyObject *
 Repository_create_blob_fromiobase(Repository *self, PyObject *py_file)
 {
+    git_writestream *stream;
     git_oid   oid;
     PyObject *py_is_readable;
     int       is_readable;
@@ -915,8 +894,47 @@
         return NULL;
     }
 
-    err = git_blob_create_fromchunks(&oid, self->repo, NULL, &read_chunk,
-                                     py_file);
+    err = git_blob_create_fromstream(&stream, self->repo, NULL);
+    if (err < 0)
+           return Error_set(err);
+
+    for (;;) {
+        PyObject *py_bytes;
+        char *bytes;
+        Py_ssize_t size;
+
+        py_bytes = PyObject_CallMethod(py_file, "read", "i", 4096);
+        if (!py_bytes)
+            return NULL;
+
+        if (py_bytes == Py_None) {
+            Py_DECREF(py_bytes);
+            goto cleanup;
+        }
+
+        if (PyBytes_AsStringAndSize(py_bytes, &bytes, &size)) {
+            Py_DECREF(py_bytes);
+            return NULL;
+       }
+
+       if (size == 0) {
+            Py_DECREF(py_bytes);
+            break;
+       }
+
+        err = stream->write(stream, bytes, size);
+        Py_DECREF(py_bytes);
+        if (err < 0)
+            goto cleanup;
+    }
+
+cleanup:
+    if (err < 0) {
+        stream->free(stream);
+        return Error_set(err);
+    }
+
+    err = git_blob_create_fromstream_commit(&oid, stream);
     if (err < 0)
         return Error_set(err);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/src/types.h 
new/pygit2-0.25.0/src/types.h
--- old/pygit2-0.24.2/src/types.h       2016-03-05 17:16:00.000000000 +0100
+++ new/pygit2-0.25.0/src/types.h       2016-12-23 21:37:58.000000000 +0100
@@ -32,8 +32,8 @@
 #include <Python.h>
 #include <git2.h>
 
-#if !(LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR == 24)
-#error You need a compatible libgit2 version (v0.24.x)
+#if !(LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR == 25)
+#error You need a compatible libgit2 version (v0.25.x)
 #endif
 
 /*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pygit2-0.24.2/test/test_options.py 
new/pygit2-0.25.0/test/test_options.py
--- old/pygit2-0.24.2/test/test_options.py      2015-10-25 13:02:52.000000000 
+0100
+++ new/pygit2-0.25.0/test/test_options.py      2016-12-03 17:13:03.000000000 
+0100
@@ -31,9 +31,14 @@
 from __future__ import unicode_literals
 import unittest
 import pygit2
+from pygit2 import GIT_OBJ_BLOB
 from pygit2 import GIT_OPT_GET_MWINDOW_SIZE, GIT_OPT_SET_MWINDOW_SIZE
 from pygit2 import GIT_OPT_GET_SEARCH_PATH, GIT_OPT_SET_SEARCH_PATH
+from pygit2 import GIT_OPT_GET_MWINDOW_MAPPED_LIMIT, 
GIT_OPT_SET_MWINDOW_MAPPED_LIMIT
 from pygit2 import GIT_CONFIG_LEVEL_SYSTEM, GIT_CONFIG_LEVEL_XDG, 
GIT_CONFIG_LEVEL_GLOBAL
+from pygit2 import GIT_OPT_SET_CACHE_OBJECT_LIMIT
+from pygit2 import GIT_OPT_GET_CACHED_MEMORY
+from pygit2 import GIT_OPT_ENABLE_CACHING
 from pygit2 import option
 from . import utils
 
@@ -50,6 +55,46 @@
 
         self.assertEqual(new_size, pygit2.settings.mwindow_size)
 
+    def test_mwindow_mapped_limit(self):
+        new_limit = 200 * 1024
+        option(GIT_OPT_SET_MWINDOW_MAPPED_LIMIT, new_limit)
+        self.assertEqual(new_limit, option(GIT_OPT_GET_MWINDOW_MAPPED_LIMIT))
+
+    def test_mwindow_mapped_limit(self):
+        new_limit = 300 * 1024
+        pygit2.settings.mwindow_mapped_limit = new_limit
+
+        self.assertEqual(new_limit, pygit2.settings.mwindow_mapped_limit)
+
+    def test_cache_object_limit(self):
+        new_limit = 2 * 1024
+        option(GIT_OPT_SET_CACHE_OBJECT_LIMIT, GIT_OBJ_BLOB, new_limit)
+
+    def test_cache_object_limit_proxy(self):
+        new_limit = 4 * 1024
+        pygit2.settings.cache_object_limit(GIT_OBJ_BLOB, new_limit)
+
+    def test_cached_memory(self):
+        value = option(GIT_OPT_GET_CACHED_MEMORY)
+        self.assertEqual(value[1], 256 * 1024**2)
+
+    def test_cached_memory_proxy(self):
+        self.assertEqual(pygit2.settings.cached_memory[1], 256 * 1024**2)
+
+    def test_enable_cache(self):
+        option(GIT_OPT_ENABLE_CACHING, False)
+        option(GIT_OPT_ENABLE_CACHING, True)
+
+    def test_enable_cache_proxy(self):
+        pygit2.settings.enable_caching(False)
+        pygit2.settings.enable_caching(True)
+
+    def test_cache_max_size_proxy(self):
+        pygit2.settings.cache_max_size(128 * 1024**2)
+        self.assertEqual(pygit2.settings.cached_memory[1], 128 * 1024**2)
+        pygit2.settings.cache_max_size(256 * 1024**2)
+        self.assertEqual(pygit2.settings.cached_memory[1], 256 * 1024**2)
+
     def test_search_path(self):
         paths = [(GIT_CONFIG_LEVEL_GLOBAL, '/tmp/global'),
                  (GIT_CONFIG_LEVEL_XDG,    '/tmp/xdg'),


Reply via email to