Merge tag '0.24.2' into debian/newton

New upstream release
d/patches: Rebased for new release

Change-Id: Ie42a447c94064e02deb9c80673b2a523469e92a7
This commit is contained in:
Ondřej Nový 2016-11-17 20:21:54 +01:00
commit 5280cf2f42
19 changed files with 202 additions and 71 deletions

@ -18,3 +18,7 @@ Vlad Temian <vladtemian@gmail.com>
Matthew Gamble <git@matthewgamble.net> Matthew Gamble <git@matthewgamble.net>
Kaarel Kitsemets <kitsemets@gmail.com> Kaarel Kitsemets <kitsemets@gmail.com>
Matthias Bartelmeß <mba@fourplusone.de>
Robert Hölzl <robert.hoelzl@posteo.de>
Anatoly Techtonik <techtonik@gmail.com>

@ -5,6 +5,9 @@ pygit2 - libgit2 bindings in Python
.. image:: https://travis-ci.org/libgit2/pygit2.svg?branch=master .. image:: https://travis-ci.org/libgit2/pygit2.svg?branch=master
:target: http://travis-ci.org/libgit2/pygit2 :target: http://travis-ci.org/libgit2/pygit2
.. image:: https://ci.appveyor.com/api/projects/status/edmwc0dctk5nacx0/branch/master?svg=true
:target: https://ci.appveyor.com/project/jdavid/pygit2/branch/master
Pygit2 is a set of Python bindings to the libgit2 shared library, libgit2 Pygit2 is a set of Python bindings to the libgit2 shared library, libgit2
implements Git plumbing. Pygit2 works with Python 2.7, 3.2, 3.3, 3.4, 3.5 and implements Git plumbing. Pygit2 works with Python 2.7, 3.2, 3.3, 3.4, 3.5 and
PyPy 2.6 PyPy 2.6
@ -25,6 +28,27 @@ How to install
Changelog Changelog
============== ==============
0.24.2 (2016-11-01)
-------------------------
- Unit tests pass on Windows, integration with AppVeyor
`#641 <https://github.com/libgit2/pygit2/pull/641>`_
`#655 <https://github.com/libgit2/pygit2/issues/655>`_
`#657 <https://github.com/libgit2/pygit2/pull/657>`_
`#659 <https://github.com/libgit2/pygit2/pull/659>`_
`#660 <https://github.com/libgit2/pygit2/pull/660>`_
`#661 <https://github.com/libgit2/pygit2/pull/661>`_
`#667 <https://github.com/libgit2/pygit2/pull/667>`_
- Fix when libgit2 error messages have non-ascii chars
`#651 <https://github.com/libgit2/pygit2/pull/651>`_
- Documentation improvements
`#643 <https://github.com/libgit2/pygit2/pull/643>`_
`#653 <https://github.com/libgit2/pygit2/pull/653>`_
`#663 <https://github.com/libgit2/pygit2/pull/663>`_
0.24.1 (2016-06-21) 0.24.1 (2016-06-21)
------------------------- -------------------------
@ -797,30 +821,31 @@ Other: `#331 <https://github.com/libgit2/pygit2/pull/331>`_
Authors Authors
============== ==============
108 developers have contributed at least 1 commit to pygit2:: 112 developers have contributed at least 1 commit to pygit2::
J. David Ibáñez Carlos Martín Nieto Nico von Geyso J. David Ibáñez Carlos Martín Nieto Nico von Geyso
W. Trevor King Dave Borowitz Daniel Rodríguez Troitiño W. Trevor King Dave Borowitz Matthias Bartelmeß
Richo Healey Christian Boos Julien Miotte Daniel Rodríguez Troitiño Richo Healey Christian Boos
Richard Möhn Xu Tao Jose Plana Julien Miotte Richard Möhn Xu Tao
Matthew Duggan Matthew Gamble Martin Lenders Jose Plana Matthew Duggan Matthew Gamble
Petr Hosek Victor Garcia Xavier Delannoy Martin Lenders Petr Hosek Victor Garcia
Yonggang Luo Patrick Steinhardt Valentin Haenel Xavier Delannoy Yonggang Luo Patrick Steinhardt
Michael Jones Bernardo Heynemann Brodie Rao Valentin Haenel Michael Jones Bernardo Heynemann
John Szakmeister Vlad Temian Nicolas Dandrimont Brodie Rao John Szakmeister Vlad Temian
David Versmisse Rémi Duraffort Santiago Perez De Rosso Nicolas Dandrimont David Versmisse Rémi Duraffort
Sebastian Thiel Thom Wiggers Alok Singhal Santiago Perez De Rosso Sebastian Thiel Thom Wiggers
Fraser Tweedale Han-Wen Nienhuys Leonardo Rhodes Alok Singhal Fraser Tweedale Han-Wen Nienhuys
Petr Viktorin Ron Cohen Thomas Kluyver Leonardo Rhodes Petr Viktorin Ron Cohen
Alex Chamberlain Alexander Bayandin Amit Bakshi Thomas Kluyver anatoly techtonik Alex Chamberlain
Andrey Devyatkin Arno van Lumig Ben Davis Alexander Bayandin Amit Bakshi Andrey Devyatkin
Dustin Raimondi Eric Schrijver Greg Fitzgerald Arno van Lumig Ben Davis Dustin Raimondi
Hervé Cauwelier Huang Huang Ian P. McCullough Eric Schrijver Greg Fitzgerald Hervé Cauwelier
Igor Gnatenko Jack O'Connor Jared Flatow Huang Huang Ian P. McCullough Igor Gnatenko
Jiunn Haur Lim Jun Omae Kaarel Kitsemets Jack O'Connor Jared Flatow Jiunn Haur Lim
Kevin KIN-FOO Masud Rahman Michael Sondergaard Jun Omae Kaarel Kitsemets Kevin KIN-FOO
Ondřej Nový Sarath Lakshman Vicent Marti Masud Rahman Michael Sondergaard Ondřej Nový
Zoran Zaric Adam Spiers Andrew Chin Sarath Lakshman Vicent Marti Zoran Zaric
mrh1997 Adam Spiers Andrew Chin
András Veres-Szentkirályi Ash Berlin Benjamin Kircher András Veres-Szentkirályi Ash Berlin Benjamin Kircher
Benjamin Pollack Bryan O'Sullivan Cam Cope Benjamin Pollack Bryan O'Sullivan Cam Cope
Chason Chaffin Chris Rebert Colin Watson Chason Chaffin Chris Rebert Colin Watson
@ -832,9 +857,10 @@ Authors
Justin Clift Kyriakos Oikonomakos Lukas Fleischer Justin Clift Kyriakos Oikonomakos Lukas Fleischer
Mathieu Bridon Nicolás Sanguinetti Noah Fontes Mathieu Bridon Nicolás Sanguinetti Noah Fontes
Óscar San José Peter Dave Hello Philippe Ombredanne Óscar San José Peter Dave Hello Philippe Ombredanne
Ridge Kennedy Ross Nicoll Rui Abreu Ferreira Ridge Kennedy Robert Hölzl Ross Nicoll
Sheeo Soasme Vladimir Rutsky Rui Abreu Ferreira Sheeo Soasme
Yu Jianjian chengyuhang earl Vladimir Rutsky Yu Jianjian chengyuhang
earl
License License

49
appveyor.yml Normal file

@ -0,0 +1,49 @@
version: 1.0.{build}
image: Visual Studio 2015
configuration: Release
environment:
matrix:
- GENERATOR: 'Visual Studio 10'
PYTHON: 'C:\Python27\python.exe'
- GENERATOR: 'Visual Studio 10 Win64'
PYTHON: 'C:\Python27-x64\python.exe'
- GENERATOR: 'Visual Studio 10'
PYTHON: 'C:\Python33\python.exe'
- GENERATOR: 'Visual Studio 10 Win64'
PYTHON: 'C:\Python33-x64\python.exe'
- GENERATOR: 'Visual Studio 10'
PYTHON: 'C:\Python34\python.exe'
- GENERATOR: 'Visual Studio 10 Win64'
PYTHON: 'C:\Python34-x64\python.exe'
- GENERATOR: 'Visual Studio 14'
PYTHON: 'C:\Python35\python.exe'
- GENERATOR: 'Visual Studio 14 Win64'
PYTHON: 'C:\Python35-x64\python.exe'
init:
- cmd: '%PYTHON% -m pip install -U nose wheel'
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
mkdir build
cd build
cmake -DSTDCALL=OFF -DBUILD_CLAR=OFF -DCMAKE_INSTALL_PREFIX="%LIBGIT2%" ../libgit2 -G "%GENERATOR%"
cmake --build . --config Release --target install
cd ..
IF "%GENERATOR%"=="Visual Studio 10 Win64" ( call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" )
"%PYTHON%" setup.py bdist_wheel
test_script:
- ps: |
cp build\Release\git2.dll .
&$env:PYTHON setup.py nosetests --with-xunit
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# upload results to AppVeyor
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nosetests.xml))
artifacts:
- path: dist\*.whl

6
debian/changelog vendored

@ -1,10 +1,12 @@
python-pygit2 (0.24.1-2) UNRELEASED; urgency=medium python-pygit2 (0.24.2-1) unstable; urgency=medium
* New upstream release
* d/s/options: extend-diff-ignore of .gitreview * d/s/options: extend-diff-ignore of .gitreview
* d/control: Using OpenStack's Gerrit as VCS URLs. * d/control: Using OpenStack's Gerrit as VCS URLs.
* Bumped debhelper version to 10 * Bumped debhelper version to 10
* d/patches: Rebased for new release
-- Ondřej Nový <onovy@debian.org> Thu, 17 Nov 2016 16:41:17 +0100 -- Ondřej Nový <onovy@debian.org> Thu, 17 Nov 2016 20:31:10 +0100
python-pygit2 (0.24.1-1) unstable; urgency=medium python-pygit2 (0.24.1-1) unstable; urgency=medium

@ -64,7 +64,7 @@ Last-Update: 2016-02-06
unittest.main() unittest.main()
--- a/test/test_remote.py --- a/test/test_remote.py
+++ b/test/test_remote.py +++ b/test/test_remote.py
@@ -49,44 +49,6 @@ @@ -50,44 +50,6 @@
ORIGIN_REFSPEC = '+refs/heads/*:refs/remotes/origin/*' ORIGIN_REFSPEC = '+refs/heads/*:refs/remotes/origin/*'
class RepositoryTest(utils.RepoTestCase): class RepositoryTest(utils.RepoTestCase):
@ -109,7 +109,7 @@ Last-Update: 2016-02-06
def test_remote_rename(self): def test_remote_rename(self):
remote = self.repo.remotes[0] remote = self.repo.remotes[0]
@@ -99,22 +61,6 @@ @@ -100,22 +62,6 @@
self.assertRaises(ValueError, self.repo.remotes.rename, None, None) self.assertRaises(ValueError, self.repo.remotes.rename, None, None)
@ -132,7 +132,7 @@ Last-Update: 2016-02-06
def test_refspec(self): def test_refspec(self):
remote = self.repo.remotes["origin"] remote = self.repo.remotes["origin"]
@@ -156,30 +102,6 @@ @@ -157,30 +103,6 @@
remote = self.repo.remotes["origin"] remote = self.repo.remotes["origin"]
self.assertEqual(['+refs/test/*:refs/test/remotes/*'], remote.push_refspecs) self.assertEqual(['+refs/test/*:refs/test/remotes/*'], remote.push_refspecs)
@ -165,7 +165,7 @@ Last-Update: 2016-02-06
start = sys.getrefcount(self.repo) start = sys.getrefcount(self.repo)
--- a/test/test_repository.py --- a/test/test_repository.py
+++ b/test/test_repository.py +++ b/test/test_repository.py
@@ -527,13 +527,6 @@ @@ -538,13 +538,6 @@
self.assertTrue('refs/remotes/custom_remote/master' in repo.listall_references()) self.assertTrue('refs/remotes/custom_remote/master' in repo.listall_references())
self.assertIsNotNone(repo.remotes["custom_remote"]) self.assertIsNotNone(repo.remotes["custom_remote"])

@ -3,14 +3,17 @@ Author: Thomas Goirand <zigo@debian.org>
Forwarded: no Forwarded: no
Last-Update: 2015-09-08 Last-Update: 2015-09-08
--- python-pygit2-0.23.0.orig/docs/development.rst --- a/docs/development.rst
+++ python-pygit2-0.23.0/docs/development.rst +++ b/docs/development.rst
@@ -2,9 +2,6 @@ @@ -2,12 +2,6 @@
The development version The development version
********************************************************************** **********************************************************************
-.. image:: https://travis-ci.org/libgit2/pygit2.svg?branch=master -.. image:: https://travis-ci.org/libgit2/pygit2.svg?branch=master
- :target: http://travis-ci.org/libgit2/pygit2 - :target: http://travis-ci.org/libgit2/pygit2
-
-.. image:: https://ci.appveyor.com/api/projects/status/edmwc0dctk5nacx0/branch/master?svg=true
- :target: https://ci.appveyor.com/project/jdavid/pygit2/branch/master
- -
.. code-block:: sh .. code-block:: sh

@ -52,7 +52,7 @@ copyright = u'2010-2015 The pygit2 contributors'
# The short X.Y version. # The short X.Y version.
version = '0.24' version = '0.24'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.24.0' release = '0.24.2'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.

@ -5,6 +5,9 @@ The development version
.. image:: https://travis-ci.org/libgit2/pygit2.svg?branch=master .. image:: https://travis-ci.org/libgit2/pygit2.svg?branch=master
:target: http://travis-ci.org/libgit2/pygit2 :target: http://travis-ci.org/libgit2/pygit2
.. image:: https://ci.appveyor.com/api/projects/status/edmwc0dctk5nacx0/branch/master?svg=true
:target: https://ci.appveyor.com/project/jdavid/pygit2/branch/master
.. code-block:: sh .. code-block:: sh
$ git clone git://github.com/libgit2/pygit2.git $ git clone git://github.com/libgit2/pygit2.git

@ -18,7 +18,7 @@ library that has been built against. The version number has a
.. py:data:: LIBGIT2_VER_MAJOR .. py:data:: LIBGIT2_VER_MAJOR
Integer value of the major version number. For example, for the version Integer value of the major version number. For example, for the version
``0.24.1``:: ``0.24.2``::
>>> print LIBGIT2_VER_MAJOR >>> print LIBGIT2_VER_MAJOR
0 0
@ -26,7 +26,7 @@ library that has been built against. The version number has a
.. py:data:: LIBGIT2_VER_MINOR .. py:data:: LIBGIT2_VER_MINOR
Integer value of the minor version number. For example, for the version Integer value of the minor version number. For example, for the version
``0.24.1``:: ``0.24.2``::
>>> print LIBGIT2_VER_MINOR >>> print LIBGIT2_VER_MINOR
24 24
@ -34,17 +34,17 @@ library that has been built against. The version number has a
.. py:data:: LIBGIT2_VER_REVISION .. py:data:: LIBGIT2_VER_REVISION
Integer value of the revision version number. For example, for the version Integer value of the revision version number. For example, for the version
``0.24.1``:: ``0.24.2``::
>>> print LIBGIT2_VER_REVISION >>> print LIBGIT2_VER_REVISION
1 2
.. py:data:: LIBGIT2_VERSION .. py:data:: LIBGIT2_VERSION
The libgit2 version number as a string:: The libgit2 version number as a string::
>>> print LIBGIT2_VERSION >>> print LIBGIT2_VERSION
'0.24.1' '0.24.2'
Errors Errors
====== ======

@ -43,11 +43,11 @@ while the last number |lq| *.micro* |rq| auto-increments independently.
As illustration see this table of compatible releases: As illustration see this table of compatible releases:
+-----------+----------------+----------------------------------------+ +-----------+-----------------------+----------------------------------------+
|**libgit2**| 0.24.0, 0.24.1 | 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4 | |**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.23.0, 0.23.1, 0.23.2, 0.23.3 | |**pygit2** | 0.24.0, 0.24.1 0.24.2 | 0.23.0, 0.23.1, 0.23.2, 0.23.3 |
+-----------+----------------+----------------------------------------+ +-----------+-----------------------+----------------------------------------+
.. warning:: .. warning::
@ -64,9 +64,9 @@ directory, do:
.. code-block:: sh .. code-block:: sh
$ wget https://github.com/libgit2/libgit2/archive/v0.24.1.tar.gz $ wget https://github.com/libgit2/libgit2/archive/v0.24.2.tar.gz
$ tar xzf v0.24.1.tar.gz $ tar xzf v0.24.2.tar.gz
$ cd libgit2-0.24.1/ $ cd libgit2-0.24.2/
$ cmake . $ cmake .
$ make $ make
$ sudo make install $ sudo make install

@ -73,3 +73,4 @@ Below there are some general attributes and methods:
.. automethod:: pygit2.Repository.ahead_behind .. automethod:: pygit2.Repository.ahead_behind
.. automethod:: pygit2.Repository.describe .. automethod:: pygit2.Repository.describe
.. automethod:: pygit2.Repository.path_is_ignored .. automethod:: pygit2.Repository.path_is_ignored
.. automethod:: pygit2.Repository.create_reference

@ -37,7 +37,7 @@ from os import getenv
# #
# The version number of pygit2 # The version number of pygit2
# #
__version__ = '0.24.1' __version__ = '0.24.2'
# #

@ -40,7 +40,7 @@ def check_error(err, io=False):
# Error message # Error message
giterr = C.giterr_last() giterr = C.giterr_last()
if giterr != ffi.NULL: if giterr != ffi.NULL:
message = ffi.string(giterr.message).decode() message = ffi.string(giterr.message).decode('utf8')
else: else:
message = "err %d (no message provided)" % err message = "err %d (no message provided)" % err
@ -64,4 +64,6 @@ def check_error(err, io=False):
raise GitError(message) raise GitError(message)
# Indicate that we want libgit2 to pretend a function was not set # Indicate that we want libgit2 to pretend a function was not set
Passthrough = Exception("The function asked for pass-through") class Passthrough(Exception):
def __init__(self):
super(Passthrough, self).__init__( "The function asked for pass-through")

@ -28,6 +28,8 @@
# Import from the future # Import from the future
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import weakref
# Import from pygit2 # Import from pygit2
from _pygit2 import Oid, Tree, Diff from _pygit2 import Oid, Tree, Diff
from .errors import check_error from .errors import check_error
@ -305,10 +307,12 @@ class Index(object):
self._conflicts = None self._conflicts = None
return None return None
if self._conflicts is None: if self._conflicts is None or self._conflicts() is None:
self._conflicts = ConflictCollection(self) conflicts = ConflictCollection(self)
self._conflicts = weakref.ref(conflicts)
return conflicts
return self._conflicts return self._conflicts()
class IndexEntry(object): class IndexEntry(object):

@ -278,11 +278,9 @@ class RemoteCallbacks(object):
try: try:
ccred = get_credentials(credentials, url, username, allowed) ccred = get_credentials(credentials, url, username, allowed)
cred_out[0] = ccred[0] cred_out[0] = ccred[0]
except Passthrough as e:
return C.GIT_PASSTHROUGH
except Exception as e: except Exception as e:
if e is Passthrough:
return C.GIT_PASSTHROUGH
self._stored_exception = e self._stored_exception = e
return C.GIT_EUSER return C.GIT_EUSER
@ -308,15 +306,14 @@ class RemoteCallbacks(object):
val = certificate_check(None, bool(valid), ffi.string(host)) val = certificate_check(None, bool(valid), ffi.string(host))
if not val: if not val:
return C.GIT_ECERTIFICATE return C.GIT_ECERTIFICATE
except Passthrough as e:
if is_ssh:
return 0
elif valid:
return 0
else:
return C.GIT_ECERTIFICATE
except Exception as e: except Exception as e:
if e is Passthrough:
if is_ssh:
return 0
elif valid:
return 0
else:
return C.GIT_ECERTIFICATE
self._stored_exception = e self._stored_exception = e
return C.GIT_EUSER return C.GIT_EUSER
@ -416,6 +413,12 @@ class Remote(object):
"""Push the given refspec to the remote. Raises ``GitError`` on """Push the given refspec to the remote. Raises ``GitError`` on
protocol error or unpack failure. protocol error or unpack failure.
When the remote has a githook installed, that denies the reference
this function will return successfully. Thus it is stronly recommended
to install a callback, that implements
:py:meth:`RemoteCallbacks.push_update_reference` and check the passed
parameters for successfull operations.
:param [str] specs: push refspecs to use :param [str] specs: push refspecs to use
""" """
push_opts = ffi.new('git_push_options *') push_opts = ffi.new('git_push_options *')

@ -322,8 +322,23 @@ class Repository(_Repository):
Keyword arguments: Keyword arguments:
a
None, a str (that refers to an Object, see revparse_single()) or a
Reference object.
If None, b must be None, too. In this case the working directory is
compared with the index. Otherwise the referred object is compared to
'b'.
b
None, a str (that refers to an Object, see revparse_single()) or a
Reference object.
If None, the working directory is compared to 'a'. (except
'cached' is True, in which case the index is compared to 'a').
Otherwise the referred object is compared to 'a'
cached cached
use staged changes instead of workdir if 'b' is None, by default the working directory is compared to 'a'.
If 'cached' is set to True, the index/staging area is used for comparing.
flag flag
a GIT_DIFF_* constant a GIT_DIFF_* constant

@ -33,6 +33,7 @@ import pygit2
import sys import sys
from pygit2 import Oid from pygit2 import Oid
from . import utils from . import utils
import gc
try: try:
import __pypy__ import __pypy__
@ -238,6 +239,11 @@ class PushTestCase(unittest.TestCase):
self.remote = self.clone.create_remote('origin', self.origin.path) self.remote = self.clone.create_remote('origin', self.origin.path)
def tearDown(self): def tearDown(self):
self.origin = None
self.clone = None
self.remote = None
gc.collect()
self.origin_ctxtmgr.__exit__(None, None, None) self.origin_ctxtmgr.__exit__(None, None, None)
self.clone_ctxtmgr.__exit__(None, None, None) self.clone_ctxtmgr.__exit__(None, None, None)

@ -41,6 +41,12 @@ import sys
import six import six
if six.PY2:
from urllib import pathname2url
if six.PY3:
from urllib.request import pathname2url
# Import from pygit2 # Import from pygit2
from pygit2 import GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT from pygit2 import GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT
from pygit2 import init_repository, clone_repository, discover_repository from pygit2 import init_repository, clone_repository, discover_repository
@ -192,8 +198,8 @@ class RepositoryTest(utils.BareRepoTestCase):
def test_hashfile(self): def test_hashfile(self):
data = "bazbarfoo" data = "bazbarfoo"
tempfile_path = tempfile.mkstemp()[1] handle, tempfile_path = tempfile.mkstemp()
with open(tempfile_path, 'w') as fh: with os.fdopen(handle, 'w') as fh:
fh.write(data) fh.write(data)
hashed_sha1 = hashfile(tempfile_path) hashed_sha1 = hashfile(tempfile_path)
os.unlink(tempfile_path) os.unlink(tempfile_path)
@ -513,7 +519,12 @@ class CloneRepositoryTest(utils.NoRepoTestCase):
def test_clone_repository_and_remote_callbacks(self): def test_clone_repository_and_remote_callbacks(self):
src_repo_relpath = "./test/data/testrepo.git/" src_repo_relpath = "./test/data/testrepo.git/"
repo_path = os.path.join(self._temp_dir, "clone-into") repo_path = os.path.join(self._temp_dir, "clone-into")
url = 'file://' + os.path.realpath(src_repo_relpath) url = pathname2url(os.path.realpath(src_repo_relpath))
if url.startswith('///'):
url = 'file:' + url
else:
url = 'file://' + url
def create_repository(path, bare): def create_repository(path, bare):
return init_repository(path, bare) return init_repository(path, bare)

@ -35,6 +35,7 @@ import tarfile
import tempfile import tempfile
import unittest import unittest
import hashlib import hashlib
import gc
import pygit2 import pygit2
@ -94,6 +95,7 @@ class NoRepoTestCase(unittest.TestCase):
def tearDown(self): def tearDown(self):
del self.repo del self.repo
gc.collect()
rmtree(self._temp_dir) rmtree(self._temp_dir)
def assertRaisesAssign(self, exc_class, instance, name, value): def assertRaisesAssign(self, exc_class, instance, name, value):
@ -132,8 +134,8 @@ class AutoRepoTestCase(NoRepoTestCase):
self.repo = pygit2.Repository(self.repo_path) self.repo = pygit2.Repository(self.repo_path)
def tearDown(self): def tearDown(self):
self.repo_ctxtmgr.__exit__(None, None, None)
super(AutoRepoTestCase, self).tearDown() super(AutoRepoTestCase, self).tearDown()
self.repo_ctxtmgr.__exit__(None, None, None)
class BareRepoTestCase(AutoRepoTestCase): class BareRepoTestCase(AutoRepoTestCase):