From 3e28e6e896543814ea312baa9ba6c6065caba797 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 13 Oct 2018 12:41:52 +0200 Subject: [PATCH 001/103] Bump patch level: remove support for old python versions --- gitdb/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index e184e4b..344c3de 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 3) +version_info = (2, 0, 4) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index 27bb754..ea6ba18 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 3) +version_info = (2, 0, 4) __version__ = '.'.join(str(i) for i in version_info) setup( From b1adf606f416f82ec69cd83cfc2b94cddc6928bd Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 13 Oct 2018 12:45:29 +0200 Subject: [PATCH 002/103] Another version bump... dunno what happened there. --- gitdb/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 344c3de..a2d2624 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 4) +version_info = (2, 0, 5) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index ea6ba18..27eb65c 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 4) +version_info = (2, 0, 5) __version__ = '.'.join(str(i) for i in version_info) setup( From 0e4b57d4511686d1aeb5479a7aa0dad3a5338d6e Mon Sep 17 00:00:00 2001 From: xarx00 Date: Fri, 5 Apr 2019 10:46:53 +0200 Subject: [PATCH 003/103] Fix for UnicodeEncodeError in git.Repo.clone_from() when path contains non-ascii characters --- gitdb/utils/encoding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/utils/encoding.py b/gitdb/utils/encoding.py index 4d270af..d8fd59a 100644 --- a/gitdb/utils/encoding.py +++ b/gitdb/utils/encoding.py @@ -8,7 +8,7 @@ text_type = unicode -def force_bytes(data, encoding="ascii"): +def force_bytes(data, encoding="utf-8"): if isinstance(data, bytes): return data From 79b705f061b51dc151a00729b722fbdebde59f5c Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 25 Sep 2019 21:00:30 +0300 Subject: [PATCH 004/103] loose: rename only if needed Our user was experiencing issue [1] when using a git repository on NTFS mount running on Linux. The current check checks if we are running on Windows, but it should really check if we are on NTFS. And since checking fs type is not that trivial and not efficient, it is simpler and better to just always apply NTFS-specific logic, since it works on other filesystems as well. [1] https://github.com/iterative/dvc/issues/1880#issuecomment-483253764 --- gitdb/db/loose.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 192c524..53ade9f 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -225,16 +225,12 @@ def store(self, istream): if not isdir(obj_dir): mkdir(obj_dir) # END handle destination directory - # rename onto existing doesn't work on windows - if os.name == 'nt': - if isfile(obj_path): - remove(tmp_path) - else: - rename(tmp_path, obj_path) - # end rename only if needed + # rename onto existing doesn't work on NTFS + if isfile(obj_path): + remove(tmp_path) else: rename(tmp_path, obj_path) - # END handle win32 + # end rename only if needed # make sure its readable for all ! It started out as rw-- tmp file # but needs to be rwrr From d77bd023a61419effe77184c52ccf3e19afa6f60 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 28 Sep 2019 13:21:35 +0200 Subject: [PATCH 005/103] Bump version --- gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index e184e4b..344c3de 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 3) +version_info = (2, 0, 4) __version__ = '.'.join(str(i) for i in version_info) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 91d506e..a0060cf 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 91d506e120d4a0f98cbef202325e301c632445c5 +Subproject commit a0060cfdc9166bb0b3104e8015faf0689aa6daf1 diff --git a/setup.py b/setup.py index 27bb754..ea6ba18 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 3) +version_info = (2, 0, 4) __version__ = '.'.join(str(i) for i in version_info) setup( From 43e16318e9ab95f146e230afe0a7cbdc848473fe Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 28 Sep 2019 13:28:50 +0200 Subject: [PATCH 006/103] bump version again... --- gitdb/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 344c3de..4e88407 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 4) +version_info = (2, 0, 6) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index ea6ba18..6a2174f 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 4) +version_info = (2, 0, 6) __version__ = '.'.join(str(i) for i in version_info) setup( From 7729239951b5561f5bb5c2d5152ff76833b11826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 8 Jan 2020 09:36:55 +0100 Subject: [PATCH 007/103] Fix deprecated calls for Python 3.9 The array methods fromstring/tostring have been deprecated since Python 3.2. Python 3.9 removes them completely. This was discovered when trying to build gitdb package for Fedora 33. https://bugzilla.redhat.com/show_bug.cgi?id=1788660 --- gitdb/pack.py | 2 +- gitdb/test/lib.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/pack.py b/gitdb/pack.py index 115d943..2ad2324 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -410,7 +410,7 @@ def offsets(self): if self._version == 2: # read stream to array, convert to tuple a = array.array('I') # 4 byte unsigned int, long are 8 byte on 64 bit it appears - a.fromstring(buffer(self._cursor.map(), self._pack_offset, self._pack_64_offset - self._pack_offset)) + a.frombytes(buffer(self._cursor.map(), self._pack_offset, self._pack_64_offset - self._pack_offset)) # networkbyteorder to something array likes more if sys.byteorder == 'little': diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index ab1842d..42b9ddc 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -157,7 +157,7 @@ def make_bytes(size_in_bytes, randomize=False): random.shuffle(producer) # END randomize a = array('i', producer) - return a.tostring() + return a.tobytes() def make_object(type, data): From c880f6b0550770eee559091d6276a2e2b097a83a Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 15 Feb 2020 09:41:05 +0800 Subject: [PATCH 008/103] don't test python 2.7 anymore, support is dropped --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1341a1d..17d6380 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python python: - - "2.7" - "3.4" - "3.5" - "3.6" From 2f9a799a6c9d125012bb09473bbfe6110f2a7391 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 15 Feb 2020 09:59:38 +0800 Subject: [PATCH 009/103] remove appveyor It is slow, it fails, and windows support seems unmaintained, besides always having been an incredible time sink. Thanks to everyone who brought GitDb to where it is right now, and I am happy to bring windows testing back if a maintainer can be found. --- .appveyor.yml | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 2daadaa..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,49 +0,0 @@ -# CI on Windows via appveyor -environment: - - matrix: - ## MINGW - # - - PYTHON: "C:\\Python27" - PYTHON_VERSION: "2.7" - - PYTHON: "C:\\Python34-x64" - PYTHON_VERSION: "3.4" - - PYTHON: "C:\\Python35-x64" - PYTHON_VERSION: "3.5" - - PYTHON: "C:\\Miniconda35-x64" - PYTHON_VERSION: "3.5" - IS_CONDA: "yes" - -install: - - set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH% - - ## Print configuration for debugging. - # - - | - echo %PATH% - uname -a - where python pip pip2 pip3 pip34 - python --version - python -c "import struct; print(struct.calcsize('P') * 8)" - - - IF "%IS_CONDA%"=="yes" ( - conda info -a & - conda install --yes --quiet pip - ) - - pip install nose wheel coveralls - - ## For commits performed with the default user. - - | - git config --global user.email "travis@ci.com" - git config --global user.name "Travis Runner" - - - pip install -e . - -build: false - -test_script: - - IF "%PYTHON_VERSION%"=="3.5" ( - nosetests -v --with-coverage - ) ELSE ( - nosetests -v - ) From df73d7f6874ff11be1b09f65c8dc425671bb924e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 15 Feb 2020 10:01:11 +0800 Subject: [PATCH 010/103] Release 3.0.0 --- gitdb/__init__.py | 2 +- setup.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 4e88407..c9c8279 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 6) +version_info = (3, 0, 0) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index 6a2174f..a66267e 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (2, 0, 6) +version_info = (3, 0, 0) __version__ = '.'.join(str(i) for i in version_info) setup( @@ -22,7 +22,7 @@ zip_safe=False, install_requires=['smmap2 >= 2.0.0'], long_description="""GitDB is a pure-Python git object database""", - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=3.4', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Development Status :: 5 - Production/Stable", @@ -34,11 +34,10 @@ "Operating System :: Microsoft :: Windows", "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7" ] ) From e6ee8bf864c726a5461600de28d64c1f06f4e163 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 15 Feb 2020 10:03:50 +0800 Subject: [PATCH 011/103] Change package signature to the only yubikey I can use right now --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8cb323e..82c0a3b 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ release:: clean force_release:: clean git push --tags python3 setup.py sdist bdist_wheel - twine upload -s -i byronimo@gmail.com dist/* + twine upload -s -i 763629FEC8788FC35128B5F6EE029D1E5EB40300 dist/* doc:: make -C doc/ html From d6d1550a1e8dc327d5b310228a66f25a59d6ce9f Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 15 Feb 2020 14:19:38 -0600 Subject: [PATCH 012/103] Remove badges for no longer existing Issue Stats site from README --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index 917b403..9febff0 100644 --- a/README.rst +++ b/README.rst @@ -56,10 +56,6 @@ DEVELOPMENT :target: https://ci.appveyor.com/project/ankostis/gitpython/branch/master) .. image:: https://coveralls.io/repos/gitpython-developers/gitdb/badge.png :target: https://coveralls.io/r/gitpython-developers/gitdb -.. image:: http://www.issuestats.com/github/gitpython-developers/gitdb/badge/pr - :target: http://www.issuestats.com/github/gitpython-developers/gitdb -.. image:: http://www.issuestats.com/github/gitpython-developers/gitdb/badge/issue - :target: http://www.issuestats.com/github/gitpython-developers/gitdb The library is considered mature, and not under active development. It's primary (known) use is in git-python. From 58bce6bd1051e4fd5df7c5c8123a1783cc6e9f84 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 07:06:35 -0600 Subject: [PATCH 013/103] Remove and replace compat.izip --- gitdb/fun.py | 4 ++-- gitdb/pack.py | 3 +-- gitdb/utils/compat.py | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/gitdb/fun.py b/gitdb/fun.py index 8ca38c8..3a2248f 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -16,7 +16,7 @@ from gitdb.const import NULL_BYTE, BYTE_SPACE from gitdb.utils.encoding import force_text -from gitdb.utils.compat import izip, buffer, xrange, PY3 +from gitdb.utils.compat import buffer, xrange, PY3 from gitdb.typ import ( str_blob_type, str_commit_type, @@ -314,7 +314,7 @@ def check_integrity(self, target_size=-1): right.next() # this is very pythonic - we might have just use index based access here, # but this could actually be faster - for lft, rgt in izip(left, right): + for lft, rgt in zip(left, right): assert lft.rbound() == rgt.to assert lft.to + lft.ts == rgt.to # END for each pair diff --git a/gitdb/pack.py b/gitdb/pack.py index 2ad2324..748df38 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -63,7 +63,6 @@ from gitdb.const import NULL_BYTE from gitdb.utils.compat import ( - izip, buffer, xrange, to_bytes @@ -696,7 +695,7 @@ def _set_cache_(self, attr): iter_offsets = iter(offsets_sorted) iter_offsets_plus_one = iter(offsets_sorted) next(iter_offsets_plus_one) - consecutive = izip(iter_offsets, iter_offsets_plus_one) + consecutive = zip(iter_offsets, iter_offsets_plus_one) offset_map = dict(consecutive) diff --git a/gitdb/utils/compat.py b/gitdb/utils/compat.py index a7899cb..586f3bb 100644 --- a/gitdb/utils/compat.py +++ b/gitdb/utils/compat.py @@ -3,11 +3,9 @@ PY3 = sys.version_info[0] == 3 try: - from itertools import izip xrange = xrange except ImportError: # py3 - izip = zip xrange = range # end handle python version From 73a9f7965139e319446c04bbcc9794a8db0de45a Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 07:07:51 -0600 Subject: [PATCH 014/103] Remove and replace izip in TestPack --- gitdb/test/test_pack.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index 24e2a31..dd1c830 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -27,11 +27,6 @@ from gitdb.util import to_bin_sha from gitdb.utils.compat import xrange -try: - from itertools import izip -except ImportError: - izip = zip - from nose import SkipTest import os @@ -155,7 +150,7 @@ def test_pack_entity(self, rw_dir): pack_objs.extend(entity.stream_iter()) count = 0 - for info, stream in izip(entity.info_iter(), entity.stream_iter()): + for info, stream in zip(entity.info_iter(), entity.stream_iter()): count += 1 assert info.binsha == stream.binsha assert len(info.binsha) == 20 From 4a692fdd43e67810509b1c1843fa203714b14f0e Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 07:13:00 -0600 Subject: [PATCH 015/103] Remove and replace compat.xrange --- gitdb/db/pack.py | 3 +-- gitdb/fun.py | 4 ++-- gitdb/pack.py | 9 ++++----- gitdb/test/db/lib.py | 3 +-- gitdb/test/lib.py | 3 +-- gitdb/test/performance/test_pack.py | 3 +-- gitdb/test/test_pack.py | 3 +-- gitdb/utils/compat.py | 7 ------- 8 files changed, 11 insertions(+), 24 deletions(-) diff --git a/gitdb/db/pack.py b/gitdb/db/pack.py index 1e37d73..177ed7b 100644 --- a/gitdb/db/pack.py +++ b/gitdb/db/pack.py @@ -18,7 +18,6 @@ ) from gitdb.pack import PackEntity -from gitdb.utils.compat import xrange from functools import reduce @@ -107,7 +106,7 @@ def sha_iter(self): for entity in self.entities(): index = entity.index() sha_by_index = index.sha - for index in xrange(index.size()): + for index in range(index.size()): yield sha_by_index(index) # END for each index # END for each entity diff --git a/gitdb/fun.py b/gitdb/fun.py index 3a2248f..7203de9 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -16,7 +16,7 @@ from gitdb.const import NULL_BYTE, BYTE_SPACE from gitdb.utils.encoding import force_text -from gitdb.utils.compat import buffer, xrange, PY3 +from gitdb.utils.compat import buffer, PY3 from gitdb.typ import ( str_blob_type, str_commit_type, @@ -264,7 +264,7 @@ def compress(self): # if first_data_index is not None: nd = StringIO() # new data so = self[first_data_index].to # start offset in target buffer - for x in xrange(first_data_index, i - 1): + for x in range(first_data_index, i - 1): xdc = self[x] nd.write(xdc.data[:xdc.ts]) # END collect data diff --git a/gitdb/pack.py b/gitdb/pack.py index 748df38..f010554 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -64,7 +64,6 @@ from gitdb.const import NULL_BYTE from gitdb.utils.compat import ( buffer, - xrange, to_bytes ) @@ -206,7 +205,7 @@ def write(self, pack_sha, write): for t in self._objs: tmplist[byte_ord(t[0][0])] += 1 # END prepare fanout - for i in xrange(255): + for i in range(255): v = tmplist[i] sha_write(pack('>L', v)) tmplist[i + 1] += v @@ -375,7 +374,7 @@ def _read_fanout(self, byte_offset): d = self._cursor.map() out = list() append = out.append - for i in xrange(256): + for i in range(256): append(unpack_from('>L', d, byte_offset + i * 4)[0]) # END for each entry return out @@ -416,7 +415,7 @@ def offsets(self): a.byteswap() return a else: - return tuple(self.offset(index) for index in xrange(self.size())) + return tuple(self.offset(index) for index in range(self.size())) # END handle version def sha_to_index(self, sha): @@ -715,7 +714,7 @@ def _iter_objects(self, as_stream): """Iterate over all objects in our index and yield their OInfo or OStream instences""" _sha = self._index.sha _object = self._object - for index in xrange(self._index.size()): + for index in range(self._index.size()): yield _object(_sha(index), as_stream, index) # END for each index diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index 528bcc1..c6f4316 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -23,7 +23,6 @@ from gitdb.exc import BadObject from gitdb.typ import str_blob_type -from gitdb.utils.compat import xrange from io import BytesIO @@ -45,7 +44,7 @@ def _assert_object_writing_simple(self, db): # write a bunch of objects and query their streams and info null_objs = db.size() ni = 250 - for i in xrange(ni): + for i in range(ni): data = pack(">L", i) istream = IStream(str_blob_type, len(data), BytesIO(data)) new_istream = db.store(istream) diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index 42b9ddc..a04084f 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -4,7 +4,6 @@ # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Utilities used in ODB testing""" from gitdb import OStream -from gitdb.utils.compat import xrange import sys import random @@ -151,7 +150,7 @@ def make_bytes(size_in_bytes, randomize=False): """:return: string with given size in bytes :param randomize: try to produce a very random stream""" actual_size = size_in_bytes // 4 - producer = xrange(actual_size) + producer = range(actual_size) if randomize: producer = list(producer) random.shuffle(producer) diff --git a/gitdb/test/performance/test_pack.py b/gitdb/test/performance/test_pack.py index fc8d9d5..b59d5a9 100644 --- a/gitdb/test/performance/test_pack.py +++ b/gitdb/test/performance/test_pack.py @@ -17,7 +17,6 @@ from gitdb.typ import str_blob_type from gitdb.exc import UnsupportedOperation from gitdb.db.pack import PackedDB -from gitdb.utils.compat import xrange from gitdb.test.lib import skip_on_travis_ci import sys @@ -118,7 +117,7 @@ def test_correctness(self): for entity in pdb.entities(): pack_verify = entity.is_valid_stream sha_by_index = entity.index().sha - for index in xrange(entity.index().size()): + for index in range(entity.index().size()): try: assert pack_verify(sha_by_index(index), use_crc=crc) count += 1 diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index dd1c830..8bf78f0 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -25,7 +25,6 @@ from gitdb.fun import delta_types from gitdb.exc import UnsupportedOperation from gitdb.util import to_bin_sha -from gitdb.utils.compat import xrange from nose import SkipTest @@ -58,7 +57,7 @@ def _assert_index_file(self, index, version, size): assert len(index.offsets()) == size # get all data of all objects - for oidx in xrange(index.size()): + for oidx in range(index.size()): sha = index.sha(oidx) assert oidx == index.sha_to_index(sha) diff --git a/gitdb/utils/compat.py b/gitdb/utils/compat.py index 586f3bb..99e7ae6 100644 --- a/gitdb/utils/compat.py +++ b/gitdb/utils/compat.py @@ -2,13 +2,6 @@ PY3 = sys.version_info[0] == 3 -try: - xrange = xrange -except ImportError: - # py3 - xrange = range -# end handle python version - try: # Python 2 buffer = buffer From 3d14cc84b0a5e42d755d24d77a6e4af6bea8c3c1 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 07:36:03 -0600 Subject: [PATCH 016/103] Remove and replace compat.buffer --- gitdb/fun.py | 8 ++++---- gitdb/pack.py | 11 ++++------- gitdb/stream.py | 5 ++--- gitdb/utils/compat.py | 10 ---------- 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/gitdb/fun.py b/gitdb/fun.py index 7203de9..92b8b1c 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -16,7 +16,7 @@ from gitdb.const import NULL_BYTE, BYTE_SPACE from gitdb.utils.encoding import force_text -from gitdb.utils.compat import buffer, PY3 +from gitdb.utils.compat import PY3 from gitdb.typ import ( str_blob_type, str_commit_type, @@ -101,7 +101,7 @@ def delta_chunk_apply(dc, bbuf, write): :param write: write method to call with data to write""" if dc.data is None: # COPY DATA FROM SOURCE - write(buffer(bbuf, dc.so, dc.ts)) + write(bbuf[dc.so:dc.so + dc.ts]) else: # APPEND DATA # whats faster: if + 4 function calls or just a write with a slice ? @@ -698,7 +698,7 @@ def apply_delta_data(src_buf, src_buf_size, delta_buf, delta_buf_size, write): if (rbound < cp_size or rbound > src_buf_size): break - write(buffer(src_buf, cp_off, cp_size)) + write(src_buf[cp_off:cp_off + cp_size]) elif c: write(db[i:i + c]) i += c @@ -741,7 +741,7 @@ def apply_delta_data(src_buf, src_buf_size, delta_buf, delta_buf_size, write): if (rbound < cp_size or rbound > src_buf_size): break - write(buffer(src_buf, cp_off, cp_size)) + write(src_buf[cp_off:cp_off + cp_size]) elif c: write(db[i:i + c]) i += c diff --git a/gitdb/pack.py b/gitdb/pack.py index f010554..68da2b7 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -62,10 +62,7 @@ from binascii import crc32 from gitdb.const import NULL_BYTE -from gitdb.utils.compat import ( - buffer, - to_bytes -) +from gitdb.utils.compat import to_bytes import tempfile import array @@ -117,7 +114,7 @@ def pack_object_at(cursor, offset, as_stream): # END handle type id abs_data_offset = offset + total_rela_offset if as_stream: - stream = DecompressMemMapReader(buffer(data, total_rela_offset), False, uncomp_size) + stream = DecompressMemMapReader(data[total_rela_offset:], False, uncomp_size) if delta_info is None: return abs_data_offset, OPackStream(offset, type_id, uncomp_size, stream) else: @@ -408,7 +405,7 @@ def offsets(self): if self._version == 2: # read stream to array, convert to tuple a = array.array('I') # 4 byte unsigned int, long are 8 byte on 64 bit it appears - a.frombytes(buffer(self._cursor.map(), self._pack_offset, self._pack_64_offset - self._pack_offset)) + a.frombytes(self._cursor.map()[self._pack_offset:self._pack_64_offset]) # networkbyteorder to something array likes more if sys.byteorder == 'little': @@ -836,7 +833,7 @@ def is_valid_stream(self, sha, use_crc=False): while cur_pos < next_offset: rbound = min(cur_pos + chunk_size, next_offset) size = rbound - cur_pos - this_crc_value = crc_update(buffer(pack_data, cur_pos, size), this_crc_value) + this_crc_value = crc_update(pack_data[cur_pos:cur_pos + size], this_crc_value) cur_pos += size # END window size loop diff --git a/gitdb/stream.py b/gitdb/stream.py index 2f4c12d..b94ef24 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -27,7 +27,6 @@ ) from gitdb.const import NULL_BYTE, BYTE_SPACE -from gitdb.utils.compat import buffer from gitdb.utils.encoding import force_bytes has_perf_mod = False @@ -278,7 +277,7 @@ def read(self, size=-1): # END adjust winsize # takes a slice, but doesn't copy the data, it says ... - indata = buffer(self._m, self._cws, self._cwe - self._cws) + indata = self._m[self._cws:self._cwe] # get the actual window end to be sure we don't use it for computations self._cwe = self._cws + len(indata) @@ -414,7 +413,7 @@ def _set_cache_brute_(self, attr): buf = dstream.read(512) # read the header information + X offset, src_size = msb_size(buf) offset, target_size = msb_size(buf, offset) - buffer_info_list.append((buffer(buf, offset), offset, src_size, target_size)) + buffer_info_list.append((buf[offset:], offset, src_size, target_size)) max_target_size = max(max_target_size, target_size) # END for each delta stream diff --git a/gitdb/utils/compat.py b/gitdb/utils/compat.py index 99e7ae6..8c7c06b 100644 --- a/gitdb/utils/compat.py +++ b/gitdb/utils/compat.py @@ -4,22 +4,12 @@ try: # Python 2 - buffer = buffer memoryview = buffer # Assume no memory view ... def to_bytes(i): return i except NameError: # Python 3 has no `buffer`; only `memoryview` - # However, it's faster to just slice the object directly, maybe it keeps a view internally - def buffer(obj, offset, size=None): - if size is None: - # return memoryview(obj)[offset:] - return obj[offset:] - else: - # return memoryview(obj)[offset:offset+size] - return obj[offset:offset + size] - # end buffer reimplementation # smmap can return memory view objects, which can't be compared as buffers/bytes can ... def to_bytes(i): if isinstance(i, memoryview): From d1c20d559a1f264dad12d1033a052ffc1c159260 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 07:37:34 -0600 Subject: [PATCH 017/103] Remove compat.memoryview --- gitdb/utils/compat.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gitdb/utils/compat.py b/gitdb/utils/compat.py index 8c7c06b..d5791ed 100644 --- a/gitdb/utils/compat.py +++ b/gitdb/utils/compat.py @@ -4,20 +4,15 @@ try: # Python 2 - memoryview = buffer - # Assume no memory view ... def to_bytes(i): return i except NameError: - # Python 3 has no `buffer`; only `memoryview` # smmap can return memory view objects, which can't be compared as buffers/bytes can ... def to_bytes(i): if isinstance(i, memoryview): return i.tobytes() return i - memoryview = memoryview - try: MAXSIZE = sys.maxint except AttributeError: From 59c053ee05d6e5f50f8699260aa0e362b567c033 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 07:54:24 -0600 Subject: [PATCH 018/103] Remove and replace compat.to_bytes --- gitdb/pack.py | 7 +++++-- gitdb/utils/compat.py | 11 ----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/gitdb/pack.py b/gitdb/pack.py index 68da2b7..a38468e 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -62,7 +62,6 @@ from binascii import crc32 from gitdb.const import NULL_BYTE -from gitdb.utils.compat import to_bytes import tempfile import array @@ -877,7 +876,11 @@ def collect_streams_at_offset(self, offset): stream = streams[-1] while stream.type_id in delta_types: if stream.type_id == REF_DELTA: - sindex = self._index.sha_to_index(to_bytes(stream.delta_info)) + # smmap can return memory view objects, which can't be compared as buffers/bytes can ... + if isinstance(stream.delta_info, memoryview): + sindex = self._index.sha_to_index(stream.delta_info.tobytes()) + else: + sindex = self._index.sha_to_index(stream.delta_info) if sindex is None: break stream = self._pack.stream(self._index.offset(sindex)) diff --git a/gitdb/utils/compat.py b/gitdb/utils/compat.py index d5791ed..6909c53 100644 --- a/gitdb/utils/compat.py +++ b/gitdb/utils/compat.py @@ -2,17 +2,6 @@ PY3 = sys.version_info[0] == 3 -try: - # Python 2 - def to_bytes(i): - return i -except NameError: - # smmap can return memory view objects, which can't be compared as buffers/bytes can ... - def to_bytes(i): - if isinstance(i, memoryview): - return i.tobytes() - return i - try: MAXSIZE = sys.maxint except AttributeError: From 321c3b46b4792cf83bf0c5814d5a1a43cdf6933d Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 07:57:23 -0600 Subject: [PATCH 019/103] Remove and replace compat.MAXSIZE --- gitdb/db/loose.py | 4 ++-- gitdb/utils/compat.py | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 53ade9f..7bf92da 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -50,11 +50,11 @@ stream_copy ) -from gitdb.utils.compat import MAXSIZE from gitdb.utils.encoding import force_bytes import tempfile import os +import sys __all__ = ('LooseObjectDB', ) @@ -196,7 +196,7 @@ def store(self, istream): if istream.binsha is not None: # copy as much as possible, the actual uncompressed item size might # be smaller than the compressed version - stream_copy(istream.read, writer.write, MAXSIZE, self.stream_chunk_size) + stream_copy(istream.read, writer.write, sys.maxsize, self.stream_chunk_size) else: # write object with header, we have to make a new one write_object(istream.type, istream.size, istream.read, writer.write, diff --git a/gitdb/utils/compat.py b/gitdb/utils/compat.py index 6909c53..c426474 100644 --- a/gitdb/utils/compat.py +++ b/gitdb/utils/compat.py @@ -1,8 +1,3 @@ import sys PY3 = sys.version_info[0] == 3 - -try: - MAXSIZE = sys.maxint -except AttributeError: - MAXSIZE = sys.maxsize From c41268071bba593cecd420c400603e094f40a6dc Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 08:01:00 -0600 Subject: [PATCH 020/103] Remove and replace encoding.string_types --- gitdb/utils/encoding.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gitdb/utils/encoding.py b/gitdb/utils/encoding.py index 4d270af..156f016 100644 --- a/gitdb/utils/encoding.py +++ b/gitdb/utils/encoding.py @@ -1,10 +1,8 @@ from gitdb.utils import compat if compat.PY3: - string_types = (str, ) text_type = str else: - string_types = (basestring, ) text_type = unicode @@ -12,7 +10,7 @@ def force_bytes(data, encoding="ascii"): if isinstance(data, bytes): return data - if isinstance(data, string_types): + if isinstance(data, str): return data.encode(encoding) return data From 77dc809542d15c40dbe60ff55cd830082c3ad904 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 08:02:08 -0600 Subject: [PATCH 021/103] Remove and replace encoding.text_type --- gitdb/utils/encoding.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/gitdb/utils/encoding.py b/gitdb/utils/encoding.py index 156f016..25ebead 100644 --- a/gitdb/utils/encoding.py +++ b/gitdb/utils/encoding.py @@ -1,11 +1,3 @@ -from gitdb.utils import compat - -if compat.PY3: - text_type = str -else: - text_type = unicode - - def force_bytes(data, encoding="ascii"): if isinstance(data, bytes): return data @@ -17,13 +9,10 @@ def force_bytes(data, encoding="ascii"): def force_text(data, encoding="utf-8"): - if isinstance(data, text_type): + if isinstance(data, str): return data if isinstance(data, bytes): return data.decode(encoding) - if compat.PY3: - return text_type(data, encoding) - else: - return text_type(data) + return str(data, encoding) From db9a65e3b0eceb9c52359273afb3313860e5e322 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 16 Feb 2020 08:11:54 -0600 Subject: [PATCH 022/103] Remove compat.PY3 --- gitdb/fun.py | 211 ++++++++++++++---------------------------- gitdb/utils/compat.py | 3 - 2 files changed, 67 insertions(+), 147 deletions(-) delete mode 100644 gitdb/utils/compat.py diff --git a/gitdb/fun.py b/gitdb/fun.py index 92b8b1c..9846597 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -16,7 +16,6 @@ from gitdb.const import NULL_BYTE, BYTE_SPACE from gitdb.utils.encoding import force_text -from gitdb.utils.compat import PY3 from gitdb.typ import ( str_blob_type, str_commit_type, @@ -424,20 +423,12 @@ def pack_object_header_info(data): type_id = (c >> 4) & 7 # numeric type size = c & 15 # starting size s = 4 # starting bit-shift size - if PY3: - while c & 0x80: - c = byte_ord(data[i]) - i += 1 - size += (c & 0x7f) << s - s += 7 - # END character loop - else: - while c & 0x80: - c = ord(data[i]) - i += 1 - size += (c & 0x7f) << s - s += 7 - # END character loop + while c & 0x80: + c = byte_ord(data[i]) + i += 1 + size += (c & 0x7f) << s + s += 7 + # END character loop # end performance at expense of maintenance ... return (type_id, size, i) @@ -450,28 +441,16 @@ def create_pack_object_header(obj_type, obj_size): :param obj_type: pack type_id of the object :param obj_size: uncompressed size in bytes of the following object stream""" c = 0 # 1 byte - if PY3: - hdr = bytearray() # output string - - c = (obj_type << 4) | (obj_size & 0xf) - obj_size >>= 4 - while obj_size: - hdr.append(c | 0x80) - c = obj_size & 0x7f - obj_size >>= 7 - # END until size is consumed - hdr.append(c) - else: - hdr = bytes() # output string - - c = (obj_type << 4) | (obj_size & 0xf) - obj_size >>= 4 - while obj_size: - hdr += chr(c | 0x80) - c = obj_size & 0x7f - obj_size >>= 7 - # END until size is consumed - hdr += chr(c) + hdr = bytearray() # output string + + c = (obj_type << 4) | (obj_size & 0xf) + obj_size >>= 4 + while obj_size: + hdr.append(c | 0x80) + c = obj_size & 0x7f + obj_size >>= 7 + # END until size is consumed + hdr.append(c) # end handle interpreter return hdr @@ -484,26 +463,15 @@ def msb_size(data, offset=0): i = 0 l = len(data) hit_msb = False - if PY3: - while i < l: - c = data[i + offset] - size |= (c & 0x7f) << i * 7 - i += 1 - if not c & 0x80: - hit_msb = True - break - # END check msb bit - # END while in range - else: - while i < l: - c = ord(data[i + offset]) - size |= (c & 0x7f) << i * 7 - i += 1 - if not c & 0x80: - hit_msb = True - break - # END check msb bit - # END while in range + while i < l: + c = data[i + offset] + size |= (c & 0x7f) << i * 7 + i += 1 + if not c & 0x80: + hit_msb = True + break + # END check msb bit + # END while in range # end performance ... if not hit_msb: raise AssertionError("Could not find terminating MSB byte in data stream") @@ -663,93 +631,48 @@ def apply_delta_data(src_buf, src_buf_size, delta_buf, delta_buf_size, write): **Note:** transcribed to python from the similar routine in patch-delta.c""" i = 0 db = delta_buf - if PY3: - while i < delta_buf_size: - c = db[i] - i += 1 - if c & 0x80: - cp_off, cp_size = 0, 0 - if (c & 0x01): - cp_off = db[i] - i += 1 - if (c & 0x02): - cp_off |= (db[i] << 8) - i += 1 - if (c & 0x04): - cp_off |= (db[i] << 16) - i += 1 - if (c & 0x08): - cp_off |= (db[i] << 24) - i += 1 - if (c & 0x10): - cp_size = db[i] - i += 1 - if (c & 0x20): - cp_size |= (db[i] << 8) - i += 1 - if (c & 0x40): - cp_size |= (db[i] << 16) - i += 1 - - if not cp_size: - cp_size = 0x10000 - - rbound = cp_off + cp_size - if (rbound < cp_size or - rbound > src_buf_size): - break - write(src_buf[cp_off:cp_off + cp_size]) - elif c: - write(db[i:i + c]) - i += c - else: - raise ValueError("unexpected delta opcode 0") - # END handle command byte - # END while processing delta data - else: - while i < delta_buf_size: - c = ord(db[i]) - i += 1 - if c & 0x80: - cp_off, cp_size = 0, 0 - if (c & 0x01): - cp_off = ord(db[i]) - i += 1 - if (c & 0x02): - cp_off |= (ord(db[i]) << 8) - i += 1 - if (c & 0x04): - cp_off |= (ord(db[i]) << 16) - i += 1 - if (c & 0x08): - cp_off |= (ord(db[i]) << 24) - i += 1 - if (c & 0x10): - cp_size = ord(db[i]) - i += 1 - if (c & 0x20): - cp_size |= (ord(db[i]) << 8) - i += 1 - if (c & 0x40): - cp_size |= (ord(db[i]) << 16) - i += 1 - - if not cp_size: - cp_size = 0x10000 - - rbound = cp_off + cp_size - if (rbound < cp_size or - rbound > src_buf_size): - break - write(src_buf[cp_off:cp_off + cp_size]) - elif c: - write(db[i:i + c]) - i += c - else: - raise ValueError("unexpected delta opcode 0") - # END handle command byte - # END while processing delta data - # end save byte_ord call and prevent performance regression in py2 + while i < delta_buf_size: + c = db[i] + i += 1 + if c & 0x80: + cp_off, cp_size = 0, 0 + if (c & 0x01): + cp_off = db[i] + i += 1 + if (c & 0x02): + cp_off |= (db[i] << 8) + i += 1 + if (c & 0x04): + cp_off |= (db[i] << 16) + i += 1 + if (c & 0x08): + cp_off |= (db[i] << 24) + i += 1 + if (c & 0x10): + cp_size = db[i] + i += 1 + if (c & 0x20): + cp_size |= (db[i] << 8) + i += 1 + if (c & 0x40): + cp_size |= (db[i] << 16) + i += 1 + + if not cp_size: + cp_size = 0x10000 + + rbound = cp_off + cp_size + if (rbound < cp_size or + rbound > src_buf_size): + break + write(src_buf[cp_off:cp_off + cp_size]) + elif c: + write(db[i:i + c]) + i += c + else: + raise ValueError("unexpected delta opcode 0") + # END handle command byte + # END while processing delta data # yes, lets use the exact same error message that git uses :) assert i == delta_buf_size, "delta replay has gone wild" diff --git a/gitdb/utils/compat.py b/gitdb/utils/compat.py deleted file mode 100644 index c426474..0000000 --- a/gitdb/utils/compat.py +++ /dev/null @@ -1,3 +0,0 @@ -import sys - -PY3 = sys.version_info[0] == 3 From 5dd0f302f101e66d9d70a3b17ce0f379b4db214b Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 17 Feb 2020 09:15:48 +0800 Subject: [PATCH 023/103] bump version to 3.0.1 --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 22deb6d..9d3b2dc 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +***** +3.0.1 +***** + +* removed all python2 compatibility shims, GitDB now is a Python 3 program. + ***** 0.6.1 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index c9c8279..6fa31e4 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (3, 0, 0) +version_info = (3, 0, 1) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index a66267e..12cebcd 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (3, 0, 0) +version_info = (3, 0, 1) __version__ = '.'.join(str(i) for i in version_info) setup( From f356e12766480852d0e30ae7b786cdf5f24d8cea Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 17 Feb 2020 11:16:43 +0800 Subject: [PATCH 024/103] Now with PR: 3.0.2 --- doc/source/changes.rst | 2 +- gitdb/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 9d3b2dc..aa7a890 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -3,7 +3,7 @@ Changelog ######### ***** -3.0.1 +3.0.2 ***** * removed all python2 compatibility shims, GitDB now is a Python 3 program. diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 6fa31e4..5a52cf2 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (3, 0, 1) +version_info = (3, 0, 2) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index 12cebcd..a66b229 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (3, 0, 1) +version_info = (3, 0, 2) __version__ = '.'.join(str(i) for i in version_info) setup( From 02de02cbd938015ff6ba3e668da4e641fdd74c4a Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 22 Feb 2020 16:25:56 -0600 Subject: [PATCH 025/103] Restrict smmap2 version to <3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a66b229..49cbf36 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ packages=('gitdb', 'gitdb.db', 'gitdb.utils', 'gitdb.test'), license="BSD License", zip_safe=False, - install_requires=['smmap2 >= 2.0.0'], + install_requires=['smmap2>=2,<3'], long_description="""GitDB is a pure-Python git object database""", python_requires='>=3.4', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers From 139811a89279482c4df9cddb7d7e69d2e2c36c47 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 22 Feb 2020 16:26:11 -0600 Subject: [PATCH 026/103] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ed4898e..92b8872 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -smmap>=0.8.3 +smmap2>=2,<3 From 09aa35b62ed341124a7b4757acf35b849a7a39ad Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 22 Feb 2020 18:15:58 -0600 Subject: [PATCH 027/103] Improve changelog for v3.0.2 --- doc/source/changes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index aa7a890..e4d4ebc 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -6,7 +6,8 @@ Changelog 3.0.2 ***** -* removed all python2 compatibility shims, GitDB now is a Python 3 program. +* Removed Python 2 compatibility shims + (`#56 `_) ***** 0.6.1 From 74aef73b0dd1f97b89f95f67500ae9c4c405ff15 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 23 Feb 2020 00:00:54 -0600 Subject: [PATCH 028/103] v3.0.3.post1 --- doc/source/changes.rst | 15 +++++++++++++++ gitdb/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index e4d4ebc..ac4b477 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,21 @@ Changelog ######### +*********** +3.0.3.post1 +*********** + +* Fixed changelogs for v3.0.2 and v3.0.3 + +***** +3.0.3 +***** + +* Changed ``force_bytes`` to use UTF-8 encoding by default + (`#49 `_) +* Restricted smmap2 version requirement to < 3 +* Updated requirements.txt + ***** 3.0.2 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 5a52cf2..b6a0341 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (3, 0, 2) +version_info = (3, 0, 3, "post1") __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index 49cbf36..b79dcb2 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (3, 0, 2) +version_info = (3, 0, 3, "post1") __version__ = '.'.join(str(i) for i in version_info) setup( From 253dfe7092f83229d9e99059e7c51f678a557fd2 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 23 Feb 2020 09:13:36 -0600 Subject: [PATCH 029/103] v4.0.1 --- doc/source/changes.rst | 10 ++++++++++ gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- requirements.txt | 2 +- setup.py | 6 +++--- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index ac4b477..236b954 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,16 @@ Changelog ######### +***** +4.0.1 +***** + +* Switched back to the gitdb package name on PyPI and fixed the gitdb2 mirror package + (`#59 `_) +* Switched back to require smmap package and fixed version requirement to >= 3.0.1, < 4 + (`#59 `_) +* Updated smmap submodule + *********** 3.0.3.post1 *********** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index b6a0341..5d68ccb 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (3, 0, 3, "post1") +version_info = (4, 0, 1) __version__ = '.'.join(str(i) for i in version_info) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index a0060cf..d076f66 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit a0060cfdc9166bb0b3104e8015faf0689aa6daf1 +Subproject commit d076f665dae16bd03eeb9df862860d54968eda84 diff --git a/requirements.txt b/requirements.txt index 92b8872..b6ccf50 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -smmap2>=2,<3 +smmap>=3.0.1,<4 diff --git a/setup.py b/setup.py index b79dcb2..7617583 100755 --- a/setup.py +++ b/setup.py @@ -7,11 +7,11 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (3, 0, 3, "post1") +version_info = (4, 0, 1) __version__ = '.'.join(str(i) for i in version_info) setup( - name="gitdb2", + name="gitdb", version=__version__, description="Git Object Database", author=__author__, @@ -20,7 +20,7 @@ packages=('gitdb', 'gitdb.db', 'gitdb.utils', 'gitdb.test'), license="BSD License", zip_safe=False, - install_requires=['smmap2>=2,<3'], + install_requires=['smmap>=3.0.1,<4'], long_description="""GitDB is a pure-Python git object database""", python_requires='>=3.4', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers From 02d83a8bad286eba61de54616f1df183825800de Mon Sep 17 00:00:00 2001 From: Nicusor97 Date: Mon, 24 Feb 2020 17:56:18 +0200 Subject: [PATCH 030/103] Remove setup.cfg because the gitdb dropped Python 2 support --- setup.cfg | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 3c6e79c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal=1 From 9b0309553be36cd188b3fd7d2ab95e7497a5e80d Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 24 Feb 2020 10:45:10 -0600 Subject: [PATCH 031/103] v4.0.2 --- doc/source/changes.rst | 7 +++++++ gitdb/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 236b954..1e91121 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,13 @@ Changelog ######### +***** +4.0.2 +***** + +* Updated to release as Pure Python Wheel rather than Universal Wheel + (`#62 `_) + ***** 4.0.1 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 5d68ccb..df1f242 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -29,7 +29,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 1) +version_info = (4, 0, 2) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index 7617583..d110099 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 1) +version_info = (4, 0, 2) __version__ = '.'.join(str(i) for i in version_info) setup( From 77b39e915ef32ca83fb61276128e41e5d7886dc2 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 13:57:34 +0800 Subject: [PATCH 032/103] Create pythonpackage.yml --- .github/workflows/pythonpackage.yml | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/pythonpackage.yml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 0000000..4c67fbf --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,44 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1000 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Lint with flake8 + run: | + pip install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with nose + run: | + pip install nose + ulimit -n 48 + ulimit -n + nosetests -v From cc21afae16d00291ea97cc1f159a4c268b94a198 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 14:08:42 +0800 Subject: [PATCH 033/103] Replace travis with github actions --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 9febff0..05511a7 100644 --- a/README.rst +++ b/README.rst @@ -50,8 +50,8 @@ Run the tests with DEVELOPMENT =========== -.. image:: https://travis-ci.org/gitpython-developers/gitdb.svg?branch=master - :target: https://travis-ci.org/gitpython-developers/gitdb +.. image:: https://github.com/gitpython-developers/gitdb/workflows/Python%20package/badge.svg + :target: https://github.com/gitpython-developers/gitdb/actions .. image:: https://ci.appveyor.com/api/projects/status/2qa4km4ln7bfv76r/branch/master?svg=true&passingText=windows%20OK&failingText=windows%20failed :target: https://ci.appveyor.com/project/ankostis/gitpython/branch/master) .. image:: https://coveralls.io/repos/gitpython-developers/gitdb/badge.png From e6cc702bf8fdd5e742ed77d607e7b697d27bcfef Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 14:09:05 +0800 Subject: [PATCH 034/103] don't try to use __file__ when using pyoxidizer --- gitdb/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index df1f242..2b06b24 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -13,7 +13,8 @@ def _init_externals(): """Initialize external projects by putting them into the path""" for module in ('smmap',): - sys.path.append(os.path.join(os.path.dirname(__file__), 'ext', module)) + if 'PYOXIDIZER' not in os.environ: + sys.path.append(os.path.join(os.path.dirname(__file__), 'ext', module)) try: __import__(module) From 57d3f7544820f9fd4202f4ebd0f198c43c8e575d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 14:35:01 +0800 Subject: [PATCH 035/103] bump patch level; mark travis-ci as unused --- .travis.yml | 1 + gitdb/ext/smmap | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17d6380..b980d36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +# NOT USED, just for reference. See github actions for CI configuration language: python python: - "3.4" diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index d076f66..f4d7a58 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit d076f665dae16bd03eeb9df862860d54968eda84 +Subproject commit f4d7a58b4d96200cd057a38a0758d3c84901f57e diff --git a/setup.py b/setup.py index d110099..e8f8d68 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 2) +version_info = (4, 0, 3) __version__ = '.'.join(str(i) for i in version_info) setup( From 0002408bc03033ed90041d04c4547343a1505537 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 14:37:37 +0800 Subject: [PATCH 036/103] update changelog; remove sublime text (editor) configuration --- doc/source/changes.rst | 6 ++++ etc/sublime-text/gitdb.sublime-project | 44 -------------------------- 2 files changed, 6 insertions(+), 44 deletions(-) delete mode 100644 etc/sublime-text/gitdb.sublime-project diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 1e91121..3c116c3 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +***** +4.0.3 +***** + +* Support for PyOxidizer + ***** 4.0.2 ***** diff --git a/etc/sublime-text/gitdb.sublime-project b/etc/sublime-text/gitdb.sublime-project deleted file mode 100644 index d0e2e51..0000000 --- a/etc/sublime-text/gitdb.sublime-project +++ /dev/null @@ -1,44 +0,0 @@ -{ - "folders": - [ - // GITDB - //////// - { - "follow_symlinks": true, - "path": "../..", - "file_exclude_patterns" : [ - "*.sublime-workspace", - ".git", - ".noseids", - ".coverage" - ], - "folder_exclude_patterns" : [ - ".git", - "cover", - "gitdb/ext", - "dist", - "doc/build", - ".tox" - ] - }, - // SMMAP - //////// - { - "follow_symlinks": true, - "path": "../../gitdb/ext/smmap", - "file_exclude_patterns" : [ - "*.sublime-workspace", - ".git", - ".noseids", - ".coverage" - ], - "folder_exclude_patterns" : [ - ".git", - "cover", - "dist", - "doc/build", - ".tox" - ] - }, - ] -} From b8ab128b7ff8dc951ac42c1fd57d61c26864680a Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 14:40:07 +0800 Subject: [PATCH 037/103] =?UTF-8?q?Bump=20patch=20again;=20=E2=80=A6upload?= =?UTF-8?q?=20error=20due=20to=20state=20on=20disk,=20yikes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/source/changes.rst | 2 +- gitdb/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 3c116c3..69a6dba 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -3,7 +3,7 @@ Changelog ######### ***** -4.0.3 +4.0.4 ***** * Support for PyOxidizer diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 2b06b24..5f56773 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -30,7 +30,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 2) +version_info = (4, 0, 4) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index e8f8d68..48d641a 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 3) +version_info = (4, 0, 4) __version__ = '.'.join(str(i) for i in version_info) setup( From 4f08b0a2bb6715b1f143782c64e18dc33bb77487 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 14:44:35 +0800 Subject: [PATCH 038/103] Remove windows build badge [skip CI] --- README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.rst b/README.rst index 05511a7..13dad89 100644 --- a/README.rst +++ b/README.rst @@ -52,8 +52,6 @@ DEVELOPMENT .. image:: https://github.com/gitpython-developers/gitdb/workflows/Python%20package/badge.svg :target: https://github.com/gitpython-developers/gitdb/actions -.. image:: https://ci.appveyor.com/api/projects/status/2qa4km4ln7bfv76r/branch/master?svg=true&passingText=windows%20OK&failingText=windows%20failed - :target: https://ci.appveyor.com/project/ankostis/gitpython/branch/master) .. image:: https://coveralls.io/repos/gitpython-developers/gitdb/badge.png :target: https://coveralls.io/r/gitpython-developers/gitdb From 919695d4e4101237a8d2c4fb65807a42b7ff63d4 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 14:45:44 +0800 Subject: [PATCH 039/103] Also remove coveralls [skip CI] --- README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.rst b/README.rst index 13dad89..44b3edd 100644 --- a/README.rst +++ b/README.rst @@ -52,8 +52,6 @@ DEVELOPMENT .. image:: https://github.com/gitpython-developers/gitdb/workflows/Python%20package/badge.svg :target: https://github.com/gitpython-developers/gitdb/actions -.. image:: https://coveralls.io/repos/gitpython-developers/gitdb/badge.png - :target: https://coveralls.io/r/gitpython-developers/gitdb The library is considered mature, and not under active development. It's primary (known) use is in git-python. From a5d3d7e7ec4e2b52c93509bdf35999d66f91e06d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 19:41:43 +0800 Subject: [PATCH 040/103] change package signing key back to what it was --- Makefile | 2 +- gitdb/ext/smmap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 82c0a3b..a5098b7 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ release:: clean force_release:: clean git push --tags python3 setup.py sdist bdist_wheel - twine upload -s -i 763629FEC8788FC35128B5F6EE029D1E5EB40300 dist/* + twine upload -s -i 2CF6E0B51AAF73F09B1C21174D1DA68C88710E60 dist/* doc:: make -C doc/ html diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index f4d7a58..09f96f2 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit f4d7a58b4d96200cd057a38a0758d3c84901f57e +Subproject commit 09f96f289dbb674e64668bcb0a088aae9dff2a29 From 163f2649e5a5f7b8ba03fc1714bf4693b1a015d0 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 5 May 2020 11:45:15 +0800 Subject: [PATCH 041/103] Bump patch level for creating a new properly signed release --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 69a6dba..05748a0 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +***** +4.0.5 +***** + +* Re-release of 4.0.4, with known signature + ***** 4.0.4 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 5f56773..813fe5a 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -30,7 +30,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 4) +version_info = (4, 0, 5) __version__ = '.'.join(str(i) for i in version_info) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 09f96f2..5e5f940 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 09f96f289dbb674e64668bcb0a088aae9dff2a29 +Subproject commit 5e5f940dff80beaa3eedf9342ef502f5e630d5ed diff --git a/setup.py b/setup.py index 48d641a..facdf3d 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 4) +version_info = (4, 0, 5) __version__ = '.'.join(str(i) for i in version_info) setup( From e5410b4166d177f90901db4986753787d34bc48f Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 12 Jun 2020 13:52:38 +0300 Subject: [PATCH 042/103] Fix exception causes in loose.py --- gitdb/db/loose.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 7bf92da..a63a2ef 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -138,12 +138,12 @@ def _map_loose_object(self, sha): # try again without noatime try: return file_contents_ro_filepath(db_path) - except OSError: - raise BadObject(sha) + except OSError as new_e: + raise BadObject(sha) from new_e # didn't work because of our flag, don't try it again self._fd_open_flags = 0 else: - raise BadObject(sha) + raise BadObject(sha) from e # END handle error # END exception handling From 112252cef0d418fd070671e64b18558c2f2cf2f1 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sun, 14 Jun 2020 14:35:48 +0300 Subject: [PATCH 043/103] Fix exception causes all over the codebase --- gitdb/__init__.py | 4 ++-- gitdb/db/mem.py | 4 ++-- gitdb/util.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 5f56773..31e4d45 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -18,8 +18,8 @@ def _init_externals(): try: __import__(module) - except ImportError: - raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module) + except ImportError as e: + raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module) from e # END verify import # END handel imports diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py index 8711334..5b242e4 100644 --- a/gitdb/db/mem.py +++ b/gitdb/db/mem.py @@ -74,8 +74,8 @@ def stream(self, sha): # rewind stream for the next one to read ostream.stream.seek(0) return ostream - except KeyError: - raise BadObject(sha) + except KeyError as e: + raise BadObject(sha) from e # END exception handling def size(self): diff --git a/gitdb/util.py b/gitdb/util.py index d680f97..c4cafec 100644 --- a/gitdb/util.py +++ b/gitdb/util.py @@ -326,8 +326,8 @@ def open(self, write=False, stream=False): else: self._fd = fd # END handle file descriptor - except OSError: - raise IOError("Lock at %r could not be obtained" % self._lockfilepath()) + except OSError as e: + raise IOError("Lock at %r could not be obtained" % self._lockfilepath()) from e # END handle lock retrieval # open actual file if required From c96c755fa30277fbaadf79603a0b4fa1054ce2cb Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Mon, 15 Jun 2020 10:48:01 +0300 Subject: [PATCH 044/103] Add Ram Rachum to AUTHORS --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index 490baad..6c7e9b9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1,4 @@ Creator: Sebastian Thiel + +Contributors: + - Ram Rachum (@cool-RR) From 447c8a4b0cc6e8fbc4a20a5a6e2c7cfabe05368e Mon Sep 17 00:00:00 2001 From: Tom McClintock Date: Wed, 24 Mar 2021 08:57:44 -0700 Subject: [PATCH 045/103] Bumped smmap upper bound --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b6ccf50..72957a2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -smmap>=3.0.1,<4 +smmap>=3.0.1,<5 From aa7228e8dbdc2ee6b6bc385e8bee21245a10e98d Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 25 Mar 2021 06:29:35 -0500 Subject: [PATCH 046/103] v4.0.6 --- doc/source/changes.rst | 8 ++++++++ gitdb/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 05748a0..6217ffb 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,14 @@ Changelog ######### +***** +4.0.6 +***** + +* Bumped upper bound for smmap requirement + (`#67 `_, + `#68 `_) + ***** 4.0.5 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 2e127ca..ea7d1bc 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -30,7 +30,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 5) +version_info = (4, 0, 6) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index facdf3d..071b8c6 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 5) +version_info = (4, 0, 6) __version__ = '.'.join(str(i) for i in version_info) setup( From fc11a03b6d94cdf9d5841595caf104c2982934bb Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 26 Mar 2021 07:41:26 -0500 Subject: [PATCH 047/103] Update smmap upper bound in setup.py Fixes #69 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 071b8c6..edbeeff 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ packages=('gitdb', 'gitdb.db', 'gitdb.utils', 'gitdb.test'), license="BSD License", zip_safe=False, - install_requires=['smmap>=3.0.1,<4'], + install_requires=['smmap>=3.0.1,<5'], long_description="""GitDB is a pure-Python git object database""", python_requires='>=3.4', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers From 6b997cd5fd01dd91ecb08d39e5e9736bc1dc9ba5 Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 26 Mar 2021 07:43:45 -0500 Subject: [PATCH 048/103] v4.0.7 --- doc/source/changes.rst | 7 +++++++ gitdb/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 6217ffb..1a41d53 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,13 @@ Changelog ######### +***** +4.0.7 +***** + +* Updated upper bound for smmap requirement in setup.py + (`#69 `_) + ***** 4.0.6 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index ea7d1bc..bef9696 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -30,7 +30,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 6) +version_info = (4, 0, 7) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index edbeeff..59817d8 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 6) +version_info = (4, 0, 7) __version__ = '.'.join(str(i) for i in version_info) setup( From 03ab3a1d40c04d6a944299c21db61cf9ce30f6bb Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 25 Mar 2021 20:46:35 +0800 Subject: [PATCH 049/103] change signing key to the one I have --- Makefile | 2 +- gitdb/ext/smmap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a5098b7..8290756 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ release:: clean force_release:: clean git push --tags python3 setup.py sdist bdist_wheel - twine upload -s -i 2CF6E0B51AAF73F09B1C21174D1DA68C88710E60 dist/* + twine upload -s -i 27C50E7F590947D7273A741E85194C08421980C9 dist/* doc:: make -C doc/ html diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 5e5f940..30e93fe 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 5e5f940dff80beaa3eedf9342ef502f5e630d5ed +Subproject commit 30e93fee57286afae25c28a97ba65a9770f9a729 From dff15cd8ba473776f76e8a3b6359a861e72d74aa Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 19 Aug 2021 12:09:11 +0300 Subject: [PATCH 050/103] Replace deprecated unittest aliases --- gitdb/test/db/lib.py | 4 ++-- gitdb/test/db/test_git.py | 2 +- gitdb/test/db/test_loose.py | 2 +- gitdb/test/db/test_pack.py | 2 +- gitdb/test/test_pack.py | 2 +- gitdb/test/test_stream.py | 2 +- gitdb/test/test_util.py | 6 +++--- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index c6f4316..3df326b 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -102,8 +102,8 @@ def _assert_object_writing(self, db): assert ostream.type == str_blob_type assert ostream.size == len(data) else: - self.failUnlessRaises(BadObject, db.info, sha) - self.failUnlessRaises(BadObject, db.stream, sha) + self.assertRaises(BadObject, db.info, sha) + self.assertRaises(BadObject, db.stream, sha) # DIRECT STREAM COPY # our data hase been written in object format to the StringIO diff --git a/gitdb/test/db/test_git.py b/gitdb/test/db/test_git.py index acc0f15..6ecf7d7 100644 --- a/gitdb/test/db/test_git.py +++ b/gitdb/test/db/test_git.py @@ -43,7 +43,7 @@ def test_reading(self): assert gdb.partial_to_complete_sha_hex(bin_to_hex(binsha)[:8 - (i % 2)]) == binsha # END for each sha - self.failUnlessRaises(BadObject, gdb.partial_to_complete_sha_hex, "0000") + self.assertRaises(BadObject, gdb.partial_to_complete_sha_hex, "0000") @with_rw_directory def test_writing(self, path): diff --git a/gitdb/test/db/test_loose.py b/gitdb/test/db/test_loose.py index 9c25a02..8cc660b 100644 --- a/gitdb/test/db/test_loose.py +++ b/gitdb/test/db/test_loose.py @@ -32,5 +32,5 @@ def test_basics(self, path): assert bin_to_hex(ldb.partial_to_complete_sha_hex(short_sha)) == long_sha # END for each sha - self.failUnlessRaises(BadObject, ldb.partial_to_complete_sha_hex, '0000') + self.assertRaises(BadObject, ldb.partial_to_complete_sha_hex, '0000') # raises if no object could be found diff --git a/gitdb/test/db/test_pack.py b/gitdb/test/db/test_pack.py index 9694238..458d804 100644 --- a/gitdb/test/db/test_pack.py +++ b/gitdb/test/db/test_pack.py @@ -84,4 +84,4 @@ def test_writing(self, path): # assert num_ambiguous # non-existing - self.failUnlessRaises(BadObject, pdb.partial_to_complete_sha, b'\0\0', 4) + self.assertRaises(BadObject, pdb.partial_to_complete_sha, b'\0\0', 4) diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index 8bf78f0..48a1852 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -73,7 +73,7 @@ def _assert_index_file(self, index, version, size): assert index.partial_sha_to_index(sha[:l], l * 2) == oidx # END for each object index in indexfile - self.failUnlessRaises(ValueError, index.partial_sha_to_index, "\0", 2) + self.assertRaises(ValueError, index.partial_sha_to_index, "\0", 2) def _assert_pack_file(self, pack, version, size): assert pack.version() == 2 diff --git a/gitdb/test/test_stream.py b/gitdb/test/test_stream.py index 9626825..5d4b93d 100644 --- a/gitdb/test/test_stream.py +++ b/gitdb/test/test_stream.py @@ -135,7 +135,7 @@ def test_compressed_writer(self): ostream.close() # its closed already - self.failUnlessRaises(OSError, os.close, fd) + self.assertRaises(OSError, os.close, fd) # read everything back, compare to data we zip fd = os.open(path, os.O_RDONLY | getattr(os, 'O_BINARY', 0)) diff --git a/gitdb/test/test_util.py b/gitdb/test/test_util.py index 847bdab..3b3165d 100644 --- a/gitdb/test/test_util.py +++ b/gitdb/test/test_util.py @@ -40,8 +40,8 @@ def test_lockedfd(self): lockfilepath = lfd._lockfilepath() # cannot end before it was started - self.failUnlessRaises(AssertionError, lfd.rollback) - self.failUnlessRaises(AssertionError, lfd.commit) + self.assertRaises(AssertionError, lfd.rollback) + self.assertRaises(AssertionError, lfd.commit) # open for writing assert not os.path.isfile(lockfilepath) @@ -77,7 +77,7 @@ def test_lockedfd(self): wfdstream = lfd.open(write=True, stream=True) # this time as stream assert os.path.isfile(lockfilepath) # another one fails - self.failUnlessRaises(IOError, olfd.open) + self.assertRaises(IOError, olfd.open) wfdstream.write(new_data.encode("ascii")) lfd.commit() From 1003c6612e0ee8973ba701e317b7308b7d0136aa Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 19 Aug 2021 12:22:22 +0300 Subject: [PATCH 051/103] Fix Sphinx warnings --- doc/source/conf.py | 2 +- gitdb/db/base.py | 5 +++++ gitdb/db/mem.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 68d9a3f..3ab15ab 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -120,7 +120,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['.static'] +#html_static_path = ['.static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/gitdb/db/base.py b/gitdb/db/base.py index 2d7b9fa..f0b8a05 100644 --- a/gitdb/db/base.py +++ b/gitdb/db/base.py @@ -33,6 +33,9 @@ def __contains__(self, sha): #{ Query Interface def has_object(self, sha): """ + Whether the object identified by the given 20 bytes + binary sha is contained in the database + :return: True if the object identified by the given 20 bytes binary sha is contained in the database""" raise NotImplementedError("To be implemented in subclass") @@ -82,6 +85,8 @@ def set_ostream(self, stream): def ostream(self): """ + Return the output stream + :return: overridden output stream this instance will write to, or None if it will write to the default stream""" return self._ostream diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py index 5b242e4..212a68f 100644 --- a/gitdb/db/mem.py +++ b/gitdb/db/mem.py @@ -92,6 +92,7 @@ def stream_copy(self, sha_iter, odb): """Copy the streams as identified by sha's yielded by sha_iter into the given odb The streams will be copied directly **Note:** the object will only be written if it did not exist in the target db + :return: amount of streams actually copied into odb. If smaller than the amount of input shas, one or more objects did already exist in odb""" count = 0 From 01b6510de861ed19958ecdd445afaccd2d8a7951 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 19 Aug 2021 12:31:04 +0300 Subject: [PATCH 052/103] Remove redundant Python 2.6 code --- gitdb/stream.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gitdb/stream.py b/gitdb/stream.py index b94ef24..d58d1a6 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -30,7 +30,6 @@ from gitdb.utils.encoding import force_bytes has_perf_mod = False -PY26 = sys.version_info[:2] < (2, 7) try: from gitdb_speedups._perf import apply_delta as c_apply_delta has_perf_mod = True @@ -295,7 +294,7 @@ def read(self, size=-1): # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the # table in the github issue. This is it ... it was the only way I could make this work everywhere. # IT's CERTAINLY GOING TO BITE US IN THE FUTURE ... . - if PY26 or ((zlib.ZLIB_VERSION == '1.2.7' or zlib.ZLIB_VERSION == '1.2.5') and not sys.platform == 'darwin'): + if zlib.ZLIB_VERSION in ('1.2.7', '1.2.5') and not sys.platform == 'darwin': unused_datalen = len(self._zip.unconsumed_tail) else: unused_datalen = len(self._zip.unconsumed_tail) + len(self._zip.unused_data) From e4cd296a2101df10e400ec2f1f7ac8b5ac2c37eb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 19 Aug 2021 12:32:36 +0300 Subject: [PATCH 053/103] Remove redundant Python 2 code --- gitdb/db/mem.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py index 212a68f..b2542ff 100644 --- a/gitdb/db/mem.py +++ b/gitdb/db/mem.py @@ -82,10 +82,7 @@ def size(self): return len(self._cache) def sha_iter(self): - try: - return self._cache.iterkeys() - except AttributeError: - return self._cache.keys() + return self._cache.keys() #{ Interface def stream_copy(self, sha_iter, odb): From 0df4b09bac21b7d3e50931c01ccf261419f5e1ef Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 19 Aug 2021 12:42:16 +0300 Subject: [PATCH 054/103] Support Python 3.7-3.9 --- .github/workflows/pythonpackage.yml | 4 ++-- setup.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4c67fbf..7f35b61 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,14 +15,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 with: fetch-depth: 1000 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/setup.py b/setup.py index 59817d8..522a88f 100755 --- a/setup.py +++ b/setup.py @@ -38,6 +38,8 @@ "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7" + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", ] ) From 47a74ca590efbdc3ae59277a491562efa7acc605 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 23 Oct 2021 08:29:50 +0800 Subject: [PATCH 055/103] Allow usage of smmap 5.0 (#76) --- gitdb/ext/smmap | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 30e93fe..db88100 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 30e93fee57286afae25c28a97ba65a9770f9a729 +Subproject commit db8810096503dd8a1f5a021ff39be907417f90a7 diff --git a/requirements.txt b/requirements.txt index 72957a2..1b2e11d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -smmap>=3.0.1,<5 +smmap>=3.0.1,<6 From 9a289258074fbf92a64186274067a46f7b27666e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 23 Oct 2021 08:36:34 +0800 Subject: [PATCH 056/103] Drop support for python 3.4/3.5; make use of smmap 5.0 which does the same --- doc/source/changes.rst | 8 ++++++++ gitdb/__init__.py | 2 +- setup.py | 8 +++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 1a41d53..de448dd 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,14 @@ Changelog ######### +***** +4.0.8 +***** + +* drop support for python 3.4 and 3.5 due to EOL +* Updated upper bound for smmap requirement in setup.py + (`#69 `_) + ***** 4.0.7 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index bef9696..0d936db 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -30,7 +30,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 7) +version_info = (4, 0, 8) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index 522a88f..251ea93 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 7) +version_info = (4, 0, 8) __version__ = '.'.join(str(i) for i in version_info) setup( @@ -20,9 +20,9 @@ packages=('gitdb', 'gitdb.db', 'gitdb.utils', 'gitdb.test'), license="BSD License", zip_safe=False, - install_requires=['smmap>=3.0.1,<5'], + install_requires=['smmap>=3.0.1,<6'], long_description="""GitDB is a pure-Python git object database""", - python_requires='>=3.4', + python_requires='>=3.6', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Development Status :: 5 - Production/Stable", @@ -35,8 +35,6 @@ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", From 2913a6454c9dfc803679dc5f75315e2d821ee977 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Wed, 5 Jan 2022 21:58:22 +0800 Subject: [PATCH 057/103] Fix typos --- gitdb/__init__.py | 2 +- gitdb/db/pack.py | 2 +- gitdb/fun.py | 8 ++++---- gitdb/pack.py | 4 ++-- gitdb/stream.py | 2 +- gitdb/test/db/lib.py | 2 +- gitdb/test/db/test_pack.py | 2 +- gitdb/test/test_pack.py | 2 +- gitdb/util.py | 6 +++--- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 0d936db..b5d1939 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -21,7 +21,7 @@ def _init_externals(): except ImportError as e: raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module) from e # END verify import - # END handel imports + # END handle imports #} END initialization diff --git a/gitdb/db/pack.py b/gitdb/db/pack.py index 177ed7b..90de02b 100644 --- a/gitdb/db/pack.py +++ b/gitdb/db/pack.py @@ -131,7 +131,7 @@ def store(self, istream): def update_cache(self, force=False): """ - Update our cache with the acutally existing packs on disk. Add new ones, + Update our cache with the actually existing packs on disk. Add new ones, and remove deleted ones. We keep the unchanged ones :param force: If True, the cache will be updated even though the directory diff --git a/gitdb/fun.py b/gitdb/fun.py index 9846597..abb4277 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -103,7 +103,7 @@ def delta_chunk_apply(dc, bbuf, write): write(bbuf[dc.so:dc.so + dc.ts]) else: # APPEND DATA - # whats faster: if + 4 function calls or just a write with a slice ? + # what's faster: if + 4 function calls or just a write with a slice ? # Considering data can be larger than 127 bytes now, it should be worth it if dc.ts < len(dc.data): write(dc.data[:dc.ts]) @@ -292,7 +292,7 @@ def check_integrity(self, target_size=-1): """Verify the list has non-overlapping chunks only, and the total size matches target_size :param target_size: if not -1, the total size of the chain must be target_size - :raise AssertionError: if the size doen't match""" + :raise AssertionError: if the size doesn't match""" if target_size > -1: assert self[-1].rbound() == target_size assert reduce(lambda x, y: x + y, (d.ts for d in self), 0) == target_size @@ -331,7 +331,7 @@ def connect_with_next_base(self, bdcl): cannot be changed by any of the upcoming bases anymore. Once all our chunks are marked like that, we can stop all processing :param bdcl: data chunk list being one of our bases. They must be fed in - consequtively and in order, towards the earliest ancestor delta + consecutively and in order, towards the earliest ancestor delta :return: True if processing was done. Use it to abort processing of remaining streams if False is returned""" nfc = 0 # number of frozen chunks @@ -624,7 +624,7 @@ def apply_delta_data(src_buf, src_buf_size, delta_buf, delta_buf_size, write): :param src_buf: random access data from which the delta was created :param src_buf_size: size of the source buffer in bytes - :param delta_buf_size: size fo the delta buffer in bytes + :param delta_buf_size: size for the delta buffer in bytes :param delta_buf: random access delta data :param write: write method taking a chunk of bytes diff --git a/gitdb/pack.py b/gitdb/pack.py index a38468e..0b26c12 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -224,7 +224,7 @@ def write(self, pack_sha, write): if ofs > 0x7fffffff: tmplist.append(ofs) ofs = 0x80000000 + len(tmplist) - 1 - # END hande 64 bit offsets + # END handle 64 bit offsets sha_write(pack('>L', ofs & 0xffffffff)) # END for each offset @@ -506,7 +506,7 @@ class PackFile(LazyMixin): """A pack is a file written according to the Version 2 for git packs As we currently use memory maps, it could be assumed that the maximum size of - packs therefor is 32 bit on 32 bit systems. On 64 bit systems, this should be + packs therefore is 32 bit on 32 bit systems. On 64 bit systems, this should be fine though. **Note:** at some point, this might be implemented using streams as well, or diff --git a/gitdb/stream.py b/gitdb/stream.py index d58d1a6..37380ad 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -289,7 +289,7 @@ def read(self, size=-1): # They are thorough, and I assume it is truly working. # Why is this logic as convoluted as it is ? Please look at the table in # https://github.com/gitpython-developers/gitdb/issues/19 to learn about the test-results. - # Bascially, on py2.6, you want to use branch 1, whereas on all other python version, the second branch + # Basically, on py2.6, you want to use branch 1, whereas on all other python version, the second branch # will be the one that works. # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the # table in the github issue. This is it ... it was the only way I could make this work everywhere. diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index 3df326b..b38f1d5 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -107,7 +107,7 @@ def _assert_object_writing(self, db): # DIRECT STREAM COPY # our data hase been written in object format to the StringIO - # we pasesd as output stream. No physical database representation + # we passed as output stream. No physical database representation # was created. # Test direct stream copy of object streams, the result must be # identical to what we fed in diff --git a/gitdb/test/db/test_pack.py b/gitdb/test/db/test_pack.py index 458d804..ff96a58 100644 --- a/gitdb/test/db/test_pack.py +++ b/gitdb/test/db/test_pack.py @@ -80,7 +80,7 @@ def test_writing(self, path): # END for each sha to find # we should have at least one ambiguous, considering the small sizes - # but in our pack, there is no ambigious ... + # but in our pack, there is no ambiguous ... # assert num_ambiguous # non-existing diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index 48a1852..4b01741 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -101,7 +101,7 @@ def _assert_pack_file(self, pack, version, size): dstream = DeltaApplyReader.new(streams) except ValueError: # ignore these, old git versions use only ref deltas, - # which we havent resolved ( as we are without an index ) + # which we haven't resolved ( as we are without an index ) # Also ignore non-delta streams continue # END get deltastream diff --git a/gitdb/util.py b/gitdb/util.py index c4cafec..f9f8c0e 100644 --- a/gitdb/util.py +++ b/gitdb/util.py @@ -182,7 +182,7 @@ def file_contents_ro(fd, stream=False, allow_mmap=True): pass # END exception handling - # read manully + # read manually contents = os.read(fd, os.fstat(fd).st_size) if stream: return _RandomAccessBytesIO(contents) @@ -248,7 +248,7 @@ class LazyMixin(object): def __getattr__(self, attr): """ Whenever an attribute is requested that we do not know, we allow it - to be created and set. Next time the same attribute is reqeusted, it is simply + to be created and set. Next time the same attribute is requested, it is simply returned from our dict/slots. """ self._set_cache_(attr) # will raise in case the cache was not created @@ -332,7 +332,7 @@ def open(self, write=False, stream=False): # open actual file if required if self._fd is None: - # we could specify exlusive here, as we obtained the lock anyway + # we could specify exclusive here, as we obtained the lock anyway try: self._fd = os.open(self._filepath, os.O_RDONLY | binary) except: From e3a4cfe0ef2bc7b9c785c4fec650f5045cdd1e50 Mon Sep 17 00:00:00 2001 From: Carl George Date: Wed, 9 Feb 2022 17:15:39 -0600 Subject: [PATCH 058/103] Switch from nose to pytest This is not a full rewrite to pytest style tests, it just changes the minimum to allow pytest to run the existing tests. Resolves #72 --- .github/workflows/pythonpackage.yml | 6 +++--- Makefile | 3 +-- README.rst | 4 ++-- gitdb.pro.user | 3 +-- gitdb/test/db/test_pack.py | 4 ++-- gitdb/test/lib.py | 4 ++-- gitdb/test/test_pack.py | 4 ++-- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 7f35b61..c695ad3 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -36,9 +36,9 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with nose + - name: Test with pytest run: | - pip install nose + pip install pytest ulimit -n 48 ulimit -n - nosetests -v + pytest -v diff --git a/Makefile b/Makefile index 8290756..e063028 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ PYTHON = python SETUP = $(PYTHON) setup.py -TESTRUNNER = $(shell which nosetests) TESTFLAGS = all:: @@ -37,5 +36,5 @@ clean:: rm -f *.so coverage:: build - PYTHONPATH=. $(PYTHON) $(TESTRUNNER) --cover-package=gitdb --with-coverage --cover-erase --cover-inclusive gitdb + PYTHONPATH=. $(PYTHON) -m pytest --cov=gitdb gitdb diff --git a/README.rst b/README.rst index 44b3edd..29c70f7 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,7 @@ If you want to go up to 20% faster, you can install gitdb-speedups with: REQUIREMENTS ============ -* Python Nose - for running the tests +* pytest - for running the tests SOURCE ====== @@ -45,7 +45,7 @@ Once the clone is complete, please be sure to initialize the submodules using Run the tests with - nosetests + pytest DEVELOPMENT =========== diff --git a/gitdb.pro.user b/gitdb.pro.user index 398cb70..3ca1e21 100644 --- a/gitdb.pro.user +++ b/gitdb.pro.user @@ -233,8 +233,7 @@ - /usr/bin/nosetests - -s + /usr/bin/pytest gitdb/test/test_pack.py 2 diff --git a/gitdb/test/db/test_pack.py b/gitdb/test/db/test_pack.py index ff96a58..4539f42 100644 --- a/gitdb/test/db/test_pack.py +++ b/gitdb/test/db/test_pack.py @@ -16,7 +16,7 @@ import random import sys -from nose.plugins.skip import SkipTest +import pytest class TestPackDB(TestDBBase): @@ -24,7 +24,7 @@ class TestPackDB(TestDBBase): @with_packs_rw def test_writing(self, path): if sys.platform == "win32": - raise SkipTest("FIXME: Currently fail on windows") + pytest.skip("FIXME: Currently fail on windows") pdb = PackedDB(path) diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index a04084f..abd4ad5 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -65,8 +65,8 @@ def skip_on_travis_ci(func): @wraps(func) def wrapper(self, *args, **kwargs): if 'TRAVIS' in os.environ: - import nose - raise nose.SkipTest("Cannot run on travis-ci") + import pytest + pytest.skip("Cannot run on travis-ci") # end check for travis ci return func(self, *args, **kwargs) # end wrapper diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index 4b01741..f946197 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -26,7 +26,7 @@ from gitdb.exc import UnsupportedOperation from gitdb.util import to_bin_sha -from nose import SkipTest +import pytest import os import tempfile @@ -246,4 +246,4 @@ def rewind_streams(): def test_pack_64(self): # TODO: hex-edit a pack helping us to verify that we can handle 64 byte offsets # of course without really needing such a huge pack - raise SkipTest() + pytest.skip('not implemented') From 7c67010acf541b4269825cb2c13e226fe2d65ea9 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 24 Oct 2021 21:38:51 +0800 Subject: [PATCH 059/103] bump patch level in the hopes for a valid sig on release https://github.com/gitpython-developers/gitdb/issues/77 --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index de448dd..5ef1326 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +***** +4.0.9 +***** + +- re-release of 4.0.8 to get a valid signature. + ***** 4.0.8 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index b5d1939..2460145 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -30,7 +30,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 8) +version_info = (4, 0, 9) __version__ = '.'.join(str(i) for i in version_info) diff --git a/setup.py b/setup.py index 251ea93..31dc62f 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 8) +version_info = (4, 0, 9) __version__ = '.'.join(str(i) for i in version_info) setup( From 4762d99d978586fcdf08ade552f4712bfde6ef22 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 21 Feb 2022 10:43:54 +0800 Subject: [PATCH 060/103] Stop signing releases (#77) The key stopped producing correct signatures when upgrading MacOS, at least when used by `twine`. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e063028..a7acbb1 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ release:: clean force_release:: clean git push --tags python3 setup.py sdist bdist_wheel - twine upload -s -i 27C50E7F590947D7273A741E85194C08421980C9 dist/* + twine upload dist/* doc:: make -C doc/ html From 2ce0e3175bcbbf397d25f18b1008d1fdf54611f2 Mon Sep 17 00:00:00 2001 From: randymcmillan Date: Tue, 15 Mar 2022 17:51:07 -0400 Subject: [PATCH 061/103] .gitmodules: update smmap url Github.com is currenly redirecting the smmap url: https://github.com/Byron/smmap.git to: https://github.com/gitpython-developers/smmap For correctness we update to the url directly --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index d85b15c..e73cded 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "smmap"] path = gitdb/ext/smmap - url = https://github.com/Byron/smmap.git + url = https://github.com/gitpython-developers/smmap.git From 5f149c1a9c36c985158c0757377af958362b3582 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 16 Nov 2022 18:13:01 +0200 Subject: [PATCH 062/103] Add support for Python 3.10 and 3.11 --- .github/workflows/pythonpackage.yml | 6 +++--- setup.py | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c695ad3..3c05764 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,14 +15,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 1000 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/setup.py b/setup.py index 31dc62f..5d324cd 100755 --- a/setup.py +++ b/setup.py @@ -39,5 +39,8 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3 :: Only", ] ) From a6f0856d807efc1e7bc37d13f9cfbcdb91dea2ac Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 16 Nov 2022 18:15:02 +0200 Subject: [PATCH 063/103] Remove redundant Travis CI config/code --- .travis.yml | 20 ------------------- gitdb/test/lib.py | 15 -------------- gitdb/test/performance/test_pack.py | 4 ---- gitdb/test/performance/test_pack_streaming.py | 3 --- gitdb/test/performance/test_stream.py | 2 -- 5 files changed, 44 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b980d36..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -# NOT USED, just for reference. See github actions for CI configuration -language: python -python: - - "3.4" - - "3.5" - - "3.6" - # - "pypy" - won't work as smmap doesn't work (see smmap/.travis.yml for details) - -git: - # a higher depth is needed for one of the tests - lets fet - depth: 1000 -install: - - pip install coveralls -script: - - ulimit -n 48 - - ulimit -n - - nosetests -v --with-coverage -after_success: - - coveralls - diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index abd4ad5..465a899 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -58,21 +58,6 @@ def setUpClass(cls): #{ Decorators -def skip_on_travis_ci(func): - """All tests decorated with this one will raise SkipTest when run on travis ci. - Use it to workaround difficult to solve issues - NOTE: copied from bcore (https://github.com/Byron/bcore)""" - @wraps(func) - def wrapper(self, *args, **kwargs): - if 'TRAVIS' in os.environ: - import pytest - pytest.skip("Cannot run on travis-ci") - # end check for travis ci - return func(self, *args, **kwargs) - # end wrapper - return wrapper - - def with_rw_directory(func): """Create a temporary directory which can be written to, remove it if the test succeeds, but leave it otherwise to aid additional debugging""" diff --git a/gitdb/test/performance/test_pack.py b/gitdb/test/performance/test_pack.py index b59d5a9..643186b 100644 --- a/gitdb/test/performance/test_pack.py +++ b/gitdb/test/performance/test_pack.py @@ -17,7 +17,6 @@ from gitdb.typ import str_blob_type from gitdb.exc import UnsupportedOperation from gitdb.db.pack import PackedDB -from gitdb.test.lib import skip_on_travis_ci import sys import os @@ -26,7 +25,6 @@ class TestPackedDBPerformance(TestBigRepoR): - @skip_on_travis_ci def test_pack_random_access(self): pdb = PackedDB(os.path.join(self.gitrepopath, "objects/pack")) @@ -79,7 +77,6 @@ def test_pack_random_access(self): print("PDB: Obtained %i streams by sha and read all bytes totallying %i KiB ( %f KiB / s ) in %f s ( %f streams/s )" % (max_items, total_kib, total_kib / (elapsed or 1), elapsed, max_items / (elapsed or 1)), file=sys.stderr) - @skip_on_travis_ci def test_loose_correctness(self): """based on the pack(s) of our packed object DB, we will just copy and verify all objects in the back into the loose object db (memory). @@ -106,7 +103,6 @@ def test_loose_correctness(self): mdb._cache.clear() # end for each sha to copy - @skip_on_travis_ci def test_correctness(self): pdb = PackedDB(os.path.join(self.gitrepopath, "objects/pack")) # disabled for now as it used to work perfectly, checking big repositories takes a long time diff --git a/gitdb/test/performance/test_pack_streaming.py b/gitdb/test/performance/test_pack_streaming.py index 76f0f4a..5bf6790 100644 --- a/gitdb/test/performance/test_pack_streaming.py +++ b/gitdb/test/performance/test_pack_streaming.py @@ -12,7 +12,6 @@ from gitdb.db.pack import PackedDB from gitdb.stream import NullStream from gitdb.pack import PackEntity -from gitdb.test.lib import skip_on_travis_ci import os import sys @@ -34,7 +33,6 @@ def write(self, d): class TestPackStreamingPerformance(TestBigRepoR): - @skip_on_travis_ci def test_pack_writing(self): # see how fast we can write a pack from object streams. # This will not be fast, as we take time for decompressing the streams as well @@ -61,7 +59,6 @@ def test_pack_writing(self): print(sys.stderr, "PDB Streaming: Wrote pack of size %i kb in %f s (%f kb/s)" % (total_kb, elapsed, total_kb / (elapsed or 1)), sys.stderr) - @skip_on_travis_ci def test_stream_reading(self): # raise SkipTest() pdb = PackedDB(os.path.join(self.gitrepopath, "objects/pack")) diff --git a/gitdb/test/performance/test_stream.py b/gitdb/test/performance/test_stream.py index 92d28e4..9a8b15b 100644 --- a/gitdb/test/performance/test_stream.py +++ b/gitdb/test/performance/test_stream.py @@ -20,7 +20,6 @@ from gitdb.test.lib import ( make_memory_file, with_rw_directory, - skip_on_travis_ci ) @@ -44,7 +43,6 @@ class TestObjDBPerformance(TestBigRepoR): large_data_size_bytes = 1000 * 1000 * 50 # some MiB should do it moderate_data_size_bytes = 1000 * 1000 * 1 # just 1 MiB - @skip_on_travis_ci @with_rw_directory def test_large_data_streaming(self, path): ldb = LooseObjectDB(path) From faed217d14965932b333c07219ed401a661d2651 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 16 Nov 2022 18:16:09 +0200 Subject: [PATCH 064/103] Drop support for EOL Python 3.5 and 3.6 --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3c05764..0d039ad 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 diff --git a/setup.py b/setup.py index 5d324cd..d38b267 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ zip_safe=False, install_requires=['smmap>=3.0.1,<6'], long_description="""GitDB is a pure-Python git object database""", - python_requires='>=3.6', + python_requires='>=3.7', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Development Status :: 5 - Production/Stable", @@ -35,7 +35,6 @@ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", From 7a68270d6c78b81f577b433dc6351b26bc27b7cf Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 16 Nov 2022 18:17:20 +0200 Subject: [PATCH 065/103] Upgrade Python syntax with pyupgrade --py37-plus --- doc/source/conf.py | 9 ++++----- gitdb/db/base.py | 12 ++++++------ gitdb/db/git.py | 4 ++-- gitdb/db/loose.py | 4 ++-- gitdb/db/mem.py | 2 +- gitdb/db/pack.py | 2 +- gitdb/db/ref.py | 8 ++++---- gitdb/fun.py | 2 +- gitdb/pack.py | 4 ++-- gitdb/stream.py | 12 ++++++------ gitdb/test/db/test_ref.py | 2 +- gitdb/test/lib.py | 6 +++--- gitdb/test/performance/test_pack.py | 1 - gitdb/test/performance/test_pack_streaming.py | 1 - gitdb/test/performance/test_stream.py | 1 - gitdb/test/test_example.py | 2 +- gitdb/test/test_stream.py | 4 ++-- gitdb/util.py | 14 +++++++------- 18 files changed, 43 insertions(+), 47 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 3ab15ab..b387f60 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # GitDB documentation build configuration file, created by # sphinx-quickstart on Wed Jun 30 00:01:32 2010. @@ -38,8 +37,8 @@ master_doc = 'index' # General information about the project. -project = u'GitDB' -copyright = u'2011, Sebastian Thiel' +project = 'GitDB' +copyright = '2011, Sebastian Thiel' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -172,8 +171,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'GitDB.tex', u'GitDB Documentation', - u'Sebastian Thiel', 'manual'), + ('index', 'GitDB.tex', 'GitDB Documentation', + 'Sebastian Thiel', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/gitdb/db/base.py b/gitdb/db/base.py index f0b8a05..e89052e 100644 --- a/gitdb/db/base.py +++ b/gitdb/db/base.py @@ -22,7 +22,7 @@ __all__ = ('ObjectDBR', 'ObjectDBW', 'FileDBBase', 'CompoundDB', 'CachingDB') -class ObjectDBR(object): +class ObjectDBR: """Defines an interface for object database lookup. Objects are identified either by their 20 byte bin sha""" @@ -63,7 +63,7 @@ def sha_iter(self): #} END query interface -class ObjectDBW(object): +class ObjectDBW: """Defines an interface to create objects in the database""" @@ -105,7 +105,7 @@ def store(self, istream): #} END edit interface -class FileDBBase(object): +class FileDBBase: """Provides basic facilities to retrieve files of interest, including caching facilities to help mapping hexsha's to objects""" @@ -117,7 +117,7 @@ def __init__(self, root_path): **Note:** The base will not perform any accessablity checking as the base might not yet be accessible, but become accessible before the first access.""" - super(FileDBBase, self).__init__() + super().__init__() self._root_path = root_path #{ Interface @@ -133,7 +133,7 @@ def db_path(self, rela_path): #} END interface -class CachingDB(object): +class CachingDB: """A database which uses caches to speed-up access""" @@ -176,7 +176,7 @@ def _set_cache_(self, attr): elif attr == '_db_cache': self._db_cache = dict() else: - super(CompoundDB, self)._set_cache_(attr) + super()._set_cache_(attr) def _db_query(self, sha): """:return: database containing the given 20 byte sha diff --git a/gitdb/db/git.py b/gitdb/db/git.py index 7a43d72..e2cb468 100644 --- a/gitdb/db/git.py +++ b/gitdb/db/git.py @@ -39,7 +39,7 @@ class GitDB(FileDBBase, ObjectDBW, CompoundDB): def __init__(self, root_path): """Initialize ourselves on a git objects directory""" - super(GitDB, self).__init__(root_path) + super().__init__(root_path) def _set_cache_(self, attr): if attr == '_dbs' or attr == '_loose_db': @@ -68,7 +68,7 @@ def _set_cache_(self, attr): # finally set the value self._loose_db = loose_db else: - super(GitDB, self)._set_cache_(attr) + super()._set_cache_(attr) # END handle attrs #{ ObjectDBW interface diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index a63a2ef..4ef7750 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -75,7 +75,7 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): new_objects_mode = int("644", 8) def __init__(self, root_path): - super(LooseObjectDB, self).__init__(root_path) + super().__init__(root_path) self._hexsha_to_file = dict() # Additional Flags - might be set to 0 after the first failure # Depending on the root, this might work for some mounts, for others not, which @@ -151,7 +151,7 @@ def set_ostream(self, stream): """:raise TypeError: if the stream does not support the Sha1Writer interface""" if stream is not None and not isinstance(stream, Sha1Writer): raise TypeError("Output stream musst support the %s interface" % Sha1Writer.__name__) - return super(LooseObjectDB, self).set_ostream(stream) + return super().set_ostream(stream) def info(self, sha): m = self._map_loose_object(sha) diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py index b2542ff..1b954cb 100644 --- a/gitdb/db/mem.py +++ b/gitdb/db/mem.py @@ -37,7 +37,7 @@ class MemoryDB(ObjectDBR, ObjectDBW): exists in the target storage before introducing actual IO""" def __init__(self): - super(MemoryDB, self).__init__() + super().__init__() self._db = LooseObjectDB("path/doesnt/matter") # maps 20 byte shas to their OStream objects diff --git a/gitdb/db/pack.py b/gitdb/db/pack.py index 90de02b..1ce786b 100644 --- a/gitdb/db/pack.py +++ b/gitdb/db/pack.py @@ -39,7 +39,7 @@ class PackedDB(FileDBBase, ObjectDBR, CachingDB, LazyMixin): _sort_interval = 500 def __init__(self, root_path): - super(PackedDB, self).__init__(root_path) + super().__init__(root_path) # list of lists with three items: # * hits - number of times the pack was hit with a request # * entity - Pack entity instance diff --git a/gitdb/db/ref.py b/gitdb/db/ref.py index 2bb1de7..6bb2a64 100644 --- a/gitdb/db/ref.py +++ b/gitdb/db/ref.py @@ -20,7 +20,7 @@ class ReferenceDB(CompoundDB): ObjectDBCls = None def __init__(self, ref_file): - super(ReferenceDB, self).__init__() + super().__init__() self._ref_file = ref_file def _set_cache_(self, attr): @@ -28,7 +28,7 @@ def _set_cache_(self, attr): self._dbs = list() self._update_dbs_from_ref_file() else: - super(ReferenceDB, self)._set_cache_(attr) + super()._set_cache_(attr) # END handle attrs def _update_dbs_from_ref_file(self): @@ -44,7 +44,7 @@ def _update_dbs_from_ref_file(self): try: with codecs.open(self._ref_file, 'r', encoding="utf-8") as f: ref_paths = [l.strip() for l in f] - except (OSError, IOError): + except OSError: pass # END handle alternates @@ -79,4 +79,4 @@ def _update_dbs_from_ref_file(self): def update_cache(self, force=False): # re-read alternates and update databases self._update_dbs_from_ref_file() - return super(ReferenceDB, self).update_cache(force) + return super().update_cache(force) diff --git a/gitdb/fun.py b/gitdb/fun.py index abb4277..a4454de 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -113,7 +113,7 @@ def delta_chunk_apply(dc, bbuf, write): # END handle chunk mode -class DeltaChunk(object): +class DeltaChunk: """Represents a piece of a delta, it can either add new data, or copy existing one from a source buffer""" diff --git a/gitdb/pack.py b/gitdb/pack.py index 0b26c12..cabce4c 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -170,7 +170,7 @@ def write_stream_to_pack(read, write, zstream, base_crc=None): #} END utilities -class IndexWriter(object): +class IndexWriter: """Utility to cache index information, allowing to write all information later in one go to the given stream @@ -257,7 +257,7 @@ class PackIndexFile(LazyMixin): index_version_default = 2 def __init__(self, indexpath): - super(PackIndexFile, self).__init__() + super().__init__() self._indexpath = indexpath def close(self): diff --git a/gitdb/stream.py b/gitdb/stream.py index 37380ad..222b843 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -219,13 +219,13 @@ def read(self, size=-1): # END clamp size if size == 0: - return bytes() + return b'' # END handle depletion # deplete the buffer, then just continue using the decompress object # which has an own buffer. We just need this to transparently parse the # header from the zlib stream - dat = bytes() + dat = b'' if self._buf: if self._buflen >= size: # have enough data @@ -553,7 +553,7 @@ def size(self): #{ W Streams -class Sha1Writer(object): +class Sha1Writer: """Simple stream writer which produces a sha whenever you like as it degests everything it is supposed to write""" @@ -650,7 +650,7 @@ class FDCompressedSha1Writer(Sha1Writer): exc = IOError("Failed to write all bytes to filedescriptor") def __init__(self, fd): - super(FDCompressedSha1Writer, self).__init__() + super().__init__() self.fd = fd self.zip = zlib.compressobj(zlib.Z_BEST_SPEED) @@ -677,7 +677,7 @@ def close(self): #} END stream interface -class FDStream(object): +class FDStream: """A simple wrapper providing the most basic functions on a file descriptor with the fileobject interface. Cannot use os.fdopen as the resulting stream @@ -711,7 +711,7 @@ def close(self): close(self._fd) -class NullStream(object): +class NullStream: """A stream that does nothing but providing a stream interface. Use it like /dev/null""" diff --git a/gitdb/test/db/test_ref.py b/gitdb/test/db/test_ref.py index 2049698..664aa54 100644 --- a/gitdb/test/db/test_ref.py +++ b/gitdb/test/db/test_ref.py @@ -23,7 +23,7 @@ def make_alt_file(self, alt_path, alt_list): The list can be empty""" with open(alt_path, "wb") as alt_file: for alt in alt_list: - alt_file.write(alt.encode("utf-8") + "\n".encode("ascii")) + alt_file.write(alt.encode("utf-8") + b"\n") @with_rw_directory def test_writing(self, path): diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index 465a899..da59d3b 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -40,7 +40,7 @@ class TestBase(unittest.TestCase): @classmethod def setUpClass(cls): try: - super(TestBase, cls).setUpClass() + super().setUpClass() except AttributeError: pass @@ -70,7 +70,7 @@ def wrapper(self): try: return func(self, path) except Exception: - sys.stderr.write("Test {}.{} failed, output is at {!r}\n".format(type(self).__name__, func.__name__, path)) + sys.stderr.write(f"Test {type(self).__name__}.{func.__name__} failed, output is at {path!r}\n") keep = True raise finally: @@ -161,7 +161,7 @@ def make_memory_file(size_in_bytes, randomize=False): #{ Stream Utilities -class DummyStream(object): +class DummyStream: def __init__(self): self.was_read = False diff --git a/gitdb/test/performance/test_pack.py b/gitdb/test/performance/test_pack.py index 643186b..f034baf 100644 --- a/gitdb/test/performance/test_pack.py +++ b/gitdb/test/performance/test_pack.py @@ -3,7 +3,6 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Performance tests for object store""" -from __future__ import print_function from gitdb.test.performance.lib import ( TestBigRepoR diff --git a/gitdb/test/performance/test_pack_streaming.py b/gitdb/test/performance/test_pack_streaming.py index 5bf6790..db790f1 100644 --- a/gitdb/test/performance/test_pack_streaming.py +++ b/gitdb/test/performance/test_pack_streaming.py @@ -3,7 +3,6 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Specific test for pack streams only""" -from __future__ import print_function from gitdb.test.performance.lib import ( TestBigRepoR diff --git a/gitdb/test/performance/test_stream.py b/gitdb/test/performance/test_stream.py index 9a8b15b..91dc891 100644 --- a/gitdb/test/performance/test_stream.py +++ b/gitdb/test/performance/test_stream.py @@ -3,7 +3,6 @@ # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Performance data streaming performance""" -from __future__ import print_function from gitdb.test.performance.lib import TestBigRepoR from gitdb.db import LooseObjectDB diff --git a/gitdb/test/test_example.py b/gitdb/test/test_example.py index 6e80bf5..cc4d40d 100644 --- a/gitdb/test/test_example.py +++ b/gitdb/test/test_example.py @@ -32,7 +32,7 @@ def test_base(self): pass # END ignore exception if there are no loose objects - data = "my data".encode("ascii") + data = b"my data" istream = IStream("blob", len(data), BytesIO(data)) # the object does not yet have a sha diff --git a/gitdb/test/test_stream.py b/gitdb/test/test_stream.py index 5d4b93d..5e2e1ba 100644 --- a/gitdb/test/test_stream.py +++ b/gitdb/test/test_stream.py @@ -115,13 +115,13 @@ def test_decompress_reader(self): def test_sha_writer(self): writer = Sha1Writer() - assert 2 == writer.write("hi".encode("ascii")) + assert 2 == writer.write(b"hi") assert len(writer.sha(as_hex=1)) == 40 assert len(writer.sha(as_hex=0)) == 20 # make sure it does something ;) prev_sha = writer.sha() - writer.write("hi again".encode("ascii")) + writer.write(b"hi again") assert writer.sha() != prev_sha def test_compressed_writer(self): diff --git a/gitdb/util.py b/gitdb/util.py index f9f8c0e..3151c06 100644 --- a/gitdb/util.py +++ b/gitdb/util.py @@ -94,7 +94,7 @@ def remove(*args, **kwargs): #{ compatibility stuff ... -class _RandomAccessBytesIO(object): +class _RandomAccessBytesIO: """Wrapper to provide required functionality in case memory maps cannot or may not be used. This is only really required in python 2.4""" @@ -131,7 +131,7 @@ def byte_ord(b): #{ Routines -def make_sha(source=''.encode("ascii")): +def make_sha(source=b''): """A python2.4 workaround for the sha/hashlib module fiasco **Note** From the dulwich project """ @@ -151,7 +151,7 @@ def allocate_memory(size): try: return mmap.mmap(-1, size) # read-write by default - except EnvironmentError: + except OSError: # setup real memory instead # this of course may fail if the amount of memory is not available in # one chunk - would only be the case in python 2.4, being more likely on @@ -174,7 +174,7 @@ def file_contents_ro(fd, stream=False, allow_mmap=True): # supports stream and random access try: return mmap.mmap(fd, 0, access=mmap.ACCESS_READ) - except EnvironmentError: + except OSError: # python 2.4 issue, 0 wants to be the actual size return mmap.mmap(fd, os.fstat(fd).st_size, access=mmap.ACCESS_READ) # END handle python 2.4 @@ -234,7 +234,7 @@ def to_bin_sha(sha): #{ Utilities -class LazyMixin(object): +class LazyMixin: """ Base class providing an interface to lazily retrieve attribute values upon @@ -266,7 +266,7 @@ def _set_cache_(self, attr): pass -class LockedFD(object): +class LockedFD: """ This class facilitates a safe read and write operation to a file on disk. @@ -327,7 +327,7 @@ def open(self, write=False, stream=False): self._fd = fd # END handle file descriptor except OSError as e: - raise IOError("Lock at %r could not be obtained" % self._lockfilepath()) from e + raise OSError("Lock at %r could not be obtained" % self._lockfilepath()) from e # END handle lock retrieval # open actual file if required From c3ab5d7b28062848c2a639a60e0acfbaee7e8f90 Mon Sep 17 00:00:00 2001 From: zwimer Date: Tue, 22 Nov 2022 18:57:47 -0700 Subject: [PATCH 066/103] Prefer import to __import__ --- .gitignore | 1 + gitdb/__init__.py | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index e0b4e85..8b7da92 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ dist/ *.so .noseids *.sublime-workspace +*.egg-info diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 2460145..c5b5547 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -12,15 +12,12 @@ def _init_externals(): """Initialize external projects by putting them into the path""" - for module in ('smmap',): - if 'PYOXIDIZER' not in os.environ: - sys.path.append(os.path.join(os.path.dirname(__file__), 'ext', module)) - - try: - __import__(module) - except ImportError as e: - raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module) from e - # END verify import + if 'PYOXIDIZER' not in os.environ: + where = os.path.join(os.path.dirname(__file__), 'ext', 'smmap') + if os.path.exists(where): + sys.path.append(where) + + import smmap # END handle imports #} END initialization From 1edc7d296af635dc31030a09e73fd684eedc1d59 Mon Sep 17 00:00:00 2001 From: zwimer Date: Tue, 22 Nov 2022 19:05:11 -0700 Subject: [PATCH 067/103] Add del smmap to match previous behavior --- gitdb/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index c5b5547..94b0831 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -18,6 +18,7 @@ def _init_externals(): sys.path.append(where) import smmap + del smmap # END handle imports #} END initialization From 38c68d95eaed9bf7415781ca0102441a349893ee Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 24 Nov 2022 06:22:21 +0100 Subject: [PATCH 068/103] bump version to 4.0.10 --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 5ef1326..7d85ea5 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +****** +4.0.10 +****** + +- improvements to the way external packages are imported. + ***** 4.0.9 ***** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 94b0831..b777632 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -28,7 +28,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 9) +version_info = (4, 0, 10) __version__ = '.'.join(str(i) for i in version_info) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index db88100..334ef84 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit db8810096503dd8a1f5a021ff39be907417f90a7 +Subproject commit 334ef84a05c953ed5dbec7b9c6d4310879eeab5a diff --git a/setup.py b/setup.py index d38b267..5214849 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 9) +version_info = (4, 0, 10) __version__ = '.'.join(str(i) for i in version_info) setup( From 49c3178711ddb3510f0e96297187f823cc019871 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 24 Nov 2022 06:24:37 +0100 Subject: [PATCH 069/103] use python3 binary MacOS Ventura doesn't come with a `python` binary anymore --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a7acbb1..7aa5a71 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PYTHON = python +PYTHON = python3 SETUP = $(PYTHON) setup.py TESTFLAGS = From b6faecc46fcc4f6412149f2021447c0070eba60e Mon Sep 17 00:00:00 2001 From: Ondrej Tethal Date: Fri, 9 Dec 2022 10:21:58 +0100 Subject: [PATCH 070/103] Use ZLIB_RUNTIME_VERSION if available --- gitdb/stream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/stream.py b/gitdb/stream.py index 222b843..1b5426f 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -294,7 +294,7 @@ def read(self, size=-1): # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the # table in the github issue. This is it ... it was the only way I could make this work everywhere. # IT's CERTAINLY GOING TO BITE US IN THE FUTURE ... . - if zlib.ZLIB_VERSION in ('1.2.7', '1.2.5') and not sys.platform == 'darwin': + if getattr(zlib, 'ZLIB_RUNTIME_VERSION', zlib.ZLIB_VERSION) in ('1.2.7', '1.2.5') and not sys.platform == 'darwin': unused_datalen = len(self._zip.unconsumed_tail) else: unused_datalen = len(self._zip.unconsumed_tail) + len(self._zip.unused_data) From 32d12aa03aff193603aad1d6f08669a70607beb9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 10 Sep 2023 18:38:38 +0300 Subject: [PATCH 071/103] Bump GitHub Actions --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 0d039ad..1cefabc 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -18,7 +18,7 @@ jobs: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 1000 - name: Set up Python ${{ matrix.python-version }} From d7fc1fd3d154c809b1c021ae3fa564e9fe4b4859 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 10 Sep 2023 18:38:56 +0300 Subject: [PATCH 072/103] Add support for Python 3.12 --- .github/workflows/pythonpackage.yml | 3 ++- setup.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 1cefabc..dab41d0 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -25,6 +25,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/setup.py b/setup.py index 5214849..61b5727 100755 --- a/setup.py +++ b/setup.py @@ -40,6 +40,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", ] ) From 875acb45cd8e9353c1911717bd2cd05b3e40ed05 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 10 Sep 2023 18:39:33 +0300 Subject: [PATCH 073/103] Drop support for EOL Python 3.7 --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index dab41d0..98e670c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/setup.py b/setup.py index 61b5727..5734122 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ zip_safe=False, install_requires=['smmap>=3.0.1,<6'], long_description="""GitDB is a pure-Python git object database""", - python_requires='>=3.7', + python_requires='>=3.8', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Development Status :: 5 - Production/Stable", @@ -35,7 +35,6 @@ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", From 8ac188497e7ac1ef2e89c984ac3728319b625e1a Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 10 Sep 2023 18:14:06 -0400 Subject: [PATCH 074/103] Enable Dependabot version updates for Actions This enables Dependabot version updates for GitHub Actions only (not Python dependencies), using the exact same configuration as in GitPython. --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..203f3c8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From e7937aefaf49c72b5f4432cc1f303ed23889589a Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 02:31:34 -0400 Subject: [PATCH 075/103] Test installing project on CI This changes the CI workflow to install the project itself to get its dependency, rather than installing the dependency from requirements.txt. This is the more important thing to test, because it verifies that the project is installable and effectively declares the dependencies it needs. --- .github/workflows/pythonpackage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 98e670c..efa04a9 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -26,10 +26,10 @@ jobs: with: python-version: ${{ matrix.python-version }} allow-prereleases: true - - name: Install dependencies + - name: Install project and dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install . - name: Lint with flake8 run: | pip install flake8 From 60f7f94607996e05292896e8105ef3780779959d Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 03:38:59 -0400 Subject: [PATCH 076/103] Fix mkdir race condition in LooseObjectDB.store This replaces the conditional call to os.mkdir that raises an unintended FileExistsError if the directory is created between the check and the os.mkdir call, using a single os.makedirs call instead, with exist_ok=True. This way, we attempt creation in a way that produces no error if the directory is already present, while still raising FileExistsError if a non-directory filesystem entry (such as a regular file) is present where we want the directory to be. --- gitdb/db/loose.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 4ef7750..7ea6fef 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -8,7 +8,6 @@ ObjectDBW ) - from gitdb.exc import ( BadObject, AmbiguousObjectName @@ -33,10 +32,8 @@ bin_to_hex, exists, chmod, - isdir, isfile, remove, - mkdir, rename, dirname, basename, @@ -222,8 +219,7 @@ def store(self, istream): if tmp_path: obj_path = self.db_path(self.object_path(hexsha)) obj_dir = dirname(obj_path) - if not isdir(obj_dir): - mkdir(obj_dir) + os.makedirs(obj_dir, exist_ok=True) # END handle destination directory # rename onto existing doesn't work on NTFS if isfile(obj_path): From 9d126ce78e69fb8aba28ae89adde69298a3066a4 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 04:33:18 -0400 Subject: [PATCH 077/103] Don't cancel other jobs from the 3.12 job failing Because 3.12 is still a release candidate and if tests fail for it then one would always want to know if/how other versions also fail. This also allows actions/setup-python to install a prerelease for 3.12 only, not for other releases. --- .github/workflows/pythonpackage.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index efa04a9..c59e618 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,6 +16,11 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + include: + - experimental: false + - python-version: "3.12" + experimental: true + continue-on-error: ${{ matrix.experimental }} steps: - uses: actions/checkout@v4 @@ -25,7 +30,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - allow-prereleases: true + allow-prereleases: ${{ matrix.experimental }} - name: Install project and dependencies run: | python -m pip install --upgrade pip From 919d3cce57d0a3c398dc4ddbacbbd23942a6ff4c Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 04:17:52 -0400 Subject: [PATCH 078/103] Use actions/checkout feature to fetch all commits Setting the "fetch-depth" to a positive value fetches that many commits back (and the default value is 1), but setting it to 0 fetches all commits, as in a (deep) normal fetch. --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index efa04a9..14c7ecb 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 1000 + fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: From bd21ed46addf55fea5059d44e0477a785f4a664f Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 05:18:27 -0400 Subject: [PATCH 079/103] Revert "Drop support for EOL Python 3.7" This brings back Python 3.7 support (allowing it to be installed on 3.7, and testing on 3.7 on CI), even though 3.7 is end-of-life, because support for 3.7 is not being dropped by GitPython yet, and there is value in keeping the version ranges supported by GitPython and gitdb consistent. This reverts commit 875acb45cd8e9353c1911717bd2cd05b3e40ed05. --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3d06b4a..6849763 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - experimental: false - python-version: "3.12" diff --git a/setup.py b/setup.py index 5734122..61b5727 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ zip_safe=False, install_requires=['smmap>=3.0.1,<6'], long_description="""GitDB is a pure-Python git object database""", - python_requires='>=3.8', + python_requires='>=3.7', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Development Status :: 5 - Production/Stable", @@ -35,6 +35,7 @@ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", From e0769d1ed2d9044d7523c2eb2f8a0d44a90deb9e Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 17 Sep 2023 08:36:34 -0400 Subject: [PATCH 080/103] Fix top-of-file license URLs here in gitdb too This is the gitdb part of the fix for the top-of-file license URLs that have come to point to a page about a related but different license from the one GitPython and gitdb are (intended to be) offered under. See https://github.com/gitpython-developers/GitPython/pull/1662 for details about the problem and how it came about. --- gitdb/__init__.py | 2 +- gitdb/base.py | 2 +- gitdb/db/__init__.py | 2 +- gitdb/db/base.py | 2 +- gitdb/db/git.py | 2 +- gitdb/db/loose.py | 2 +- gitdb/db/mem.py | 2 +- gitdb/db/pack.py | 2 +- gitdb/db/ref.py | 2 +- gitdb/exc.py | 2 +- gitdb/fun.py | 2 +- gitdb/pack.py | 6 +++--- gitdb/stream.py | 10 +++++----- gitdb/test/__init__.py | 2 +- gitdb/test/db/__init__.py | 2 +- gitdb/test/db/lib.py | 2 +- gitdb/test/db/test_git.py | 2 +- gitdb/test/db/test_loose.py | 2 +- gitdb/test/db/test_mem.py | 2 +- gitdb/test/db/test_pack.py | 2 +- gitdb/test/db/test_ref.py | 2 +- gitdb/test/lib.py | 2 +- gitdb/test/performance/lib.py | 2 +- gitdb/test/performance/test_pack.py | 2 +- gitdb/test/performance/test_pack_streaming.py | 2 +- gitdb/test/performance/test_stream.py | 2 +- gitdb/test/test_base.py | 2 +- gitdb/test/test_example.py | 2 +- gitdb/test/test_pack.py | 4 ++-- gitdb/test/test_stream.py | 2 +- gitdb/test/test_util.py | 2 +- gitdb/typ.py | 2 +- gitdb/util.py | 2 +- 33 files changed, 40 insertions(+), 40 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index b777632..2fb3f7e 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Initialize the object database module""" import sys diff --git a/gitdb/base.py b/gitdb/base.py index 42e71d0..9a23a4f 100644 --- a/gitdb/base.py +++ b/gitdb/base.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module with basic data structures - they are designed to be lightweight and fast""" from gitdb.util import bin_to_hex diff --git a/gitdb/db/__init__.py b/gitdb/db/__init__.py index 0a2a46a..20fd228 100644 --- a/gitdb/db/__init__.py +++ b/gitdb/db/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.db.base import * from gitdb.db.loose import * diff --git a/gitdb/db/base.py b/gitdb/db/base.py index e89052e..7312fe0 100644 --- a/gitdb/db/base.py +++ b/gitdb/db/base.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains implementations of database retrieveing objects""" from gitdb.util import ( join, diff --git a/gitdb/db/git.py b/gitdb/db/git.py index e2cb468..a1ed142 100644 --- a/gitdb/db/git.py +++ b/gitdb/db/git.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.db.base import ( CompoundDB, ObjectDBW, diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 7ea6fef..256fec9 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.db.base import ( FileDBBase, ObjectDBR, diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py index 1b954cb..d4772fd 100644 --- a/gitdb/db/mem.py +++ b/gitdb/db/mem.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains the MemoryDatabase implementation""" from gitdb.db.loose import LooseObjectDB from gitdb.db.base import ( diff --git a/gitdb/db/pack.py b/gitdb/db/pack.py index 1ce786b..274ea59 100644 --- a/gitdb/db/pack.py +++ b/gitdb/db/pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module containing a database to deal with packs""" from gitdb.db.base import ( FileDBBase, diff --git a/gitdb/db/ref.py b/gitdb/db/ref.py index 6bb2a64..bd30156 100644 --- a/gitdb/db/ref.py +++ b/gitdb/db/ref.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ import codecs from gitdb.db.base import ( CompoundDB, diff --git a/gitdb/exc.py b/gitdb/exc.py index 947e5d8..7397037 100644 --- a/gitdb/exc.py +++ b/gitdb/exc.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module with common exceptions""" from gitdb.util import to_hex_sha diff --git a/gitdb/fun.py b/gitdb/fun.py index a4454de..a272e5c 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains basic c-functions which usually contain performance critical code Keeping this code separate from the beginning makes it easier to out-source it into c later, if required""" diff --git a/gitdb/pack.py b/gitdb/pack.py index cabce4c..e559e11 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains PackIndexFile and PackFile implementations""" import zlib @@ -263,7 +263,7 @@ def __init__(self, indexpath): def close(self): mman.force_map_handle_removal_win(self._indexpath) self._cursor = None - + def _set_cache_(self, attr): if attr == "_packfile_checksum": self._packfile_checksum = self._cursor.map()[-40:-20] @@ -528,7 +528,7 @@ def __init__(self, packpath): def close(self): mman.force_map_handle_removal_win(self._packpath) self._cursor = None - + def _set_cache_(self, attr): # we fill the whole cache, whichever attribute gets queried first self._cursor = mman.make_cursor(self._packpath).use_region() diff --git a/gitdb/stream.py b/gitdb/stream.py index 1b5426f..1e0be84 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from io import BytesIO @@ -140,7 +140,7 @@ def data(self): def close(self): """Close our underlying stream of compressed bytes if this was allowed during initialization :return: True if we closed the underlying stream - :note: can be called safely + :note: can be called safely """ if self._close: if hasattr(self._m, 'close'): @@ -287,11 +287,11 @@ def read(self, size=-1): # if we hit the end of the stream # NOTE: Behavior changed in PY2.7 onward, which requires special handling to make the tests work properly. # They are thorough, and I assume it is truly working. - # Why is this logic as convoluted as it is ? Please look at the table in + # Why is this logic as convoluted as it is ? Please look at the table in # https://github.com/gitpython-developers/gitdb/issues/19 to learn about the test-results. # Basically, on py2.6, you want to use branch 1, whereas on all other python version, the second branch - # will be the one that works. - # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the + # will be the one that works. + # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the # table in the github issue. This is it ... it was the only way I could make this work everywhere. # IT's CERTAINLY GOING TO BITE US IN THE FUTURE ... . if getattr(zlib, 'ZLIB_RUNTIME_VERSION', zlib.ZLIB_VERSION) in ('1.2.7', '1.2.5') and not sys.platform == 'darwin': diff --git a/gitdb/test/__init__.py b/gitdb/test/__init__.py index 8a681e4..03bd406 100644 --- a/gitdb/test/__init__.py +++ b/gitdb/test/__init__.py @@ -1,4 +1,4 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ diff --git a/gitdb/test/db/__init__.py b/gitdb/test/db/__init__.py index 8a681e4..03bd406 100644 --- a/gitdb/test/db/__init__.py +++ b/gitdb/test/db/__init__.py @@ -1,4 +1,4 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index b38f1d5..408dd8c 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Base classes for object db testing""" from gitdb.test.lib import ( with_rw_directory, diff --git a/gitdb/test/db/test_git.py b/gitdb/test/db/test_git.py index 6ecf7d7..73ac1a0 100644 --- a/gitdb/test/db/test_git.py +++ b/gitdb/test/db/test_git.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ import os from gitdb.test.db.lib import ( TestDBBase, diff --git a/gitdb/test/db/test_loose.py b/gitdb/test/db/test_loose.py index 8cc660b..295e2ee 100644 --- a/gitdb/test/db/test_loose.py +++ b/gitdb/test/db/test_loose.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.test.db.lib import ( TestDBBase, with_rw_directory diff --git a/gitdb/test/db/test_mem.py b/gitdb/test/db/test_mem.py index eb563c0..882e54f 100644 --- a/gitdb/test/db/test_mem.py +++ b/gitdb/test/db/test_mem.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.test.db.lib import ( TestDBBase, with_rw_directory diff --git a/gitdb/test/db/test_pack.py b/gitdb/test/db/test_pack.py index 4539f42..bd07906 100644 --- a/gitdb/test/db/test_pack.py +++ b/gitdb/test/db/test_pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.test.db.lib import ( TestDBBase, with_rw_directory, diff --git a/gitdb/test/db/test_ref.py b/gitdb/test/db/test_ref.py index 664aa54..0816e64 100644 --- a/gitdb/test/db/test_ref.py +++ b/gitdb/test/db/test_ref.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.test.db.lib import ( TestDBBase, with_rw_directory, diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index da59d3b..8e60234 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Utilities used in ODB testing""" from gitdb import OStream diff --git a/gitdb/test/performance/lib.py b/gitdb/test/performance/lib.py index fa4dd20..36916ed 100644 --- a/gitdb/test/performance/lib.py +++ b/gitdb/test/performance/lib.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains library functions""" from gitdb.test.lib import TestBase diff --git a/gitdb/test/performance/test_pack.py b/gitdb/test/performance/test_pack.py index f034baf..fc3d334 100644 --- a/gitdb/test/performance/test_pack.py +++ b/gitdb/test/performance/test_pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Performance tests for object store""" from gitdb.test.performance.lib import ( diff --git a/gitdb/test/performance/test_pack_streaming.py b/gitdb/test/performance/test_pack_streaming.py index db790f1..80c798b 100644 --- a/gitdb/test/performance/test_pack_streaming.py +++ b/gitdb/test/performance/test_pack_streaming.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Specific test for pack streams only""" from gitdb.test.performance.lib import ( diff --git a/gitdb/test/performance/test_stream.py b/gitdb/test/performance/test_stream.py index 91dc891..fb10871 100644 --- a/gitdb/test/performance/test_stream.py +++ b/gitdb/test/performance/test_stream.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Performance data streaming performance""" from gitdb.test.performance.lib import TestBigRepoR diff --git a/gitdb/test/test_base.py b/gitdb/test/test_base.py index 519cdfd..8fc9e35 100644 --- a/gitdb/test/test_base.py +++ b/gitdb/test/test_base.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Test for object db""" from gitdb.test.lib import ( TestBase, diff --git a/gitdb/test/test_example.py b/gitdb/test/test_example.py index cc4d40d..3b4c908 100644 --- a/gitdb/test/test_example.py +++ b/gitdb/test/test_example.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module with examples from the tutorial section of the docs""" import os from gitdb.test.lib import TestBase diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index f946197..e723482 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Test everything about packs reading and writing""" from gitdb.test.lib import ( TestBase, @@ -242,7 +242,7 @@ def rewind_streams(): # END for each info assert count == len(pack_objs) entity.close() - + def test_pack_64(self): # TODO: hex-edit a pack helping us to verify that we can handle 64 byte offsets # of course without really needing such a huge pack diff --git a/gitdb/test/test_stream.py b/gitdb/test/test_stream.py index 5e2e1ba..1e7e941 100644 --- a/gitdb/test/test_stream.py +++ b/gitdb/test/test_stream.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Test for object db""" from gitdb.test.lib import ( diff --git a/gitdb/test/test_util.py b/gitdb/test/test_util.py index 3b3165d..166b33c 100644 --- a/gitdb/test/test_util.py +++ b/gitdb/test/test_util.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Test for object db""" import tempfile import os diff --git a/gitdb/typ.py b/gitdb/typ.py index 98d15f3..314db50 100644 --- a/gitdb/typ.py +++ b/gitdb/typ.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module containing information about types known to the database""" str_blob_type = b'blob' diff --git a/gitdb/util.py b/gitdb/util.py index 3151c06..bb6d879 100644 --- a/gitdb/util.py +++ b/gitdb/util.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ import binascii import os import mmap From cd8da415e119451e195903576a8ff22cf60ae47b Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 3 Oct 2023 12:42:23 -0400 Subject: [PATCH 081/103] Run CI on all branches This makes it easier to test changes to CI without/before a PR. + Fix a small YAML indentation style inconsistency. --- .github/workflows/pythonpackage.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 6849763..6d819ff 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -3,11 +3,7 @@ name: Python package -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request, workflow_dispatch] jobs: build: @@ -17,9 +13,9 @@ jobs: matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - - experimental: false - - python-version: "3.12" - experimental: true + - experimental: false + - python-version: "3.12" + experimental: true continue-on-error: ${{ matrix.experimental }} steps: From 00bbc44eff7be0b43a882eadf54c2bbb2f9000a0 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 3 Oct 2023 12:44:38 -0400 Subject: [PATCH 082/103] No longer treat 3.12 as experimental on CI Since Python 3.12.0 stable has been released, as well as now being available via setup-python, per: https://github.com/actions/python-versions/blob/main/versions-manifest.json The main practical effect of this is that continue-on-error is no longer set to true for 3.12, so 3.12 is no longer special-cased to refrain from cancelling other test jobs when its test job fails. Another effect is that 3.12 can longer be selected as a prerelease. --- .github/workflows/pythonpackage.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 6d819ff..73b3902 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -14,8 +14,6 @@ jobs: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - experimental: false - - python-version: "3.12" - experimental: true continue-on-error: ${{ matrix.experimental }} steps: From 70098c9c99db872ac98a6b5c7a591a42cadf049f Mon Sep 17 00:00:00 2001 From: DeflateAwning <11021263+DeflateAwning@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:22:44 -0600 Subject: [PATCH 083/103] Add __all__ to exc for linting --- gitdb/exc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gitdb/exc.py b/gitdb/exc.py index 7397037..752dafd 100644 --- a/gitdb/exc.py +++ b/gitdb/exc.py @@ -5,6 +5,17 @@ """Module with common exceptions""" from gitdb.util import to_hex_sha +__all__ = [ + 'AmbiguousObjectName', + 'BadName', + 'BadObject', + 'BadObjectType', + 'InvalidDBRoot', + 'ODBError', + 'ParseError', + 'UnsupportedOperation', + 'to_hex_sha', +] class ODBError(Exception): """All errors thrown by the object database""" From 12db86cefa90e8fc1c8df8f5c6b4c8b7a232d773 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 13 Oct 2023 04:06:47 -0400 Subject: [PATCH 084/103] Have Dependabot update smmap submodule dependency This makes Dependabot open version update PRs for submodules (which here is just smmap), as well as GitHub Actions. This is like https://github.com/gitpython-developers/GitPython/pull/1702. --- .github/dependabot.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 203f3c8..5acde1a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,4 +3,9 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "weekly" + +- package-ecosystem: "gitsubmodule" + directory: "/" + schedule: + interval: "monthly" From 8e613962153baad0431358dda03d9fd942cef616 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 08:17:45 +0000 Subject: [PATCH 085/103] Bump gitdb/ext/smmap from `334ef84` to `f1ace75` Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `334ef84` to `f1ace75`. - [Commits](https://github.com/gitpython-developers/smmap/compare/334ef84a05c953ed5dbec7b9c6d4310879eeab5a...f1ace75be355fdec927793e462b9b12bf6ec9520) --- updated-dependencies: - dependency-name: gitdb/ext/smmap dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gitdb/ext/smmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 334ef84..f1ace75 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 334ef84a05c953ed5dbec7b9c6d4310879eeab5a +Subproject commit f1ace75be355fdec927793e462b9b12bf6ec9520 From 2057ae67b85fb9925efbd0f00f44413e506e286c Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 20 Oct 2023 09:37:58 +0200 Subject: [PATCH 086/103] bump versions to prepare for next release --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 7d85ea5..0b8de13 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +****** +4.0.11 +****** + +- various improvements - please see the release on GitHub for details. + ****** 4.0.10 ****** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 2fb3f7e..803a428 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -28,7 +28,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 10) +version_info = (4, 0, 11) __version__ = '.'.join(str(i) for i in version_info) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index f1ace75..256c5a2 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit f1ace75be355fdec927793e462b9b12bf6ec9520 +Subproject commit 256c5a21de2d14aca02c9689d7d63f78c4e0ef61 diff --git a/setup.py b/setup.py index 61b5727..f67f7a5 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 10) +version_info = (4, 0, 11) __version__ = '.'.join(str(i) for i in version_info) setup( From 3d3e9572dc452fea53d328c101b3d1440bbefe40 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 20 Oct 2023 09:42:19 +0200 Subject: [PATCH 087/103] fix makefile to allow building packages with current python version It all breaks all the time, it's just like that. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7aa5a71..a0a2d0e 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ release:: clean force_release:: clean git push --tags - python3 setup.py sdist bdist_wheel + python3 -m build --sdist --wheel twine upload dist/* doc:: From 965d2d36703a60f610e4b4a3fb1b86fe244d63d5 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 06:46:10 -0400 Subject: [PATCH 088/103] Never add a vendored smmap directory to sys.path This removes the logic that appended the git submodule directory for smmap to sys.path under most circumstances when the version of gitdb was not from PyPI. Now gitdb does not modify sys.path. See https://github.com/gitpython-developers/GitPython/issues/1717 and https://github.com/gitpython-developers/GitPython/pull/1720 for context. This change is roughly equivalent to the change to GitPython, though as noted the behavior being eliminated is subtly different here and there. --- gitdb/__init__.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 803a428..9b77e9f 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -4,34 +4,12 @@ # the New BSD License: https://opensource.org/license/bsd-3-clause/ """Initialize the object database module""" -import sys -import os - -#{ Initialization - - -def _init_externals(): - """Initialize external projects by putting them into the path""" - if 'PYOXIDIZER' not in os.environ: - where = os.path.join(os.path.dirname(__file__), 'ext', 'smmap') - if os.path.exists(where): - sys.path.append(where) - - import smmap - del smmap - # END handle imports - -#} END initialization - -_init_externals() - __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" version_info = (4, 0, 11) __version__ = '.'.join(str(i) for i in version_info) - # default imports from gitdb.base import * from gitdb.db import * From dfbfb12beee6b2c61cb02f193fabc427e0a949f6 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 07:24:33 -0400 Subject: [PATCH 089/103] Revise and update the readme Changes worth mentioning: - Format commands as code blocks instead of blockquotes. (This is particularly useful for the submodule update step, whose lines were inadvertently concatenated, but it also improves appearance overall.) - Mention smmap as a requirement. (But also that it doesn't need to be separately installed.) - Mention that gitdb-speedups is not currently maintained. - No longer say gitdb has source code in gitorious. (Since that site no longer exists.) - Call GitPython "GitPython" rather than "git-python". - Replace the old git-python Google Groups link with a link to the Discussions page on the GitHub repository for GitPython. (This seems like the closest currently available resource.) --- README.rst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 29c70f7..61ce28b 100644 --- a/README.rst +++ b/README.rst @@ -16,34 +16,38 @@ Installation :target: https://readthedocs.org/projects/gitdb/?badge=latest :alt: Documentation Status -From `PyPI `_ +From `PyPI `_:: pip install gitdb SPEEDUPS ======== -If you want to go up to 20% faster, you can install gitdb-speedups with: +If you want to go up to 20% faster, you can install gitdb-speedups with:: pip install gitdb-speedups +However, please note that gitdb-speedups is not currently maintained. + REQUIREMENTS ============ +* smmap - declared as a dependency, automatically installed * pytest - for running the tests SOURCE ====== -The source is available in a git repository at gitorious and github: + +The source is available in a git repository on GitHub: https://github.com/gitpython-developers/gitdb -Once the clone is complete, please be sure to initialize the submodules using +Once the clone is complete, please be sure to initialize the submodule using:: cd gitdb git submodule update --init -Run the tests with +Run the tests with:: pytest @@ -53,13 +57,13 @@ DEVELOPMENT .. image:: https://github.com/gitpython-developers/gitdb/workflows/Python%20package/badge.svg :target: https://github.com/gitpython-developers/gitdb/actions -The library is considered mature, and not under active development. It's primary (known) use is in git-python. +The library is considered mature, and not under active development. Its primary (known) use is in GitPython. INFRASTRUCTURE ============== -* Mailing List - * http://groups.google.com/group/git-python +* Discussions + * https://github.com/gitpython-developers/GitPython/discussions * Issue Tracker * https://github.com/gitpython-developers/gitdb/issues From e998429c01f928da7ff7c922ba3f1249c43ff569 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 07:47:10 -0400 Subject: [PATCH 090/103] Set Dependabot submodule update cadence to weekly This changes it from monthly to weekly. See #99 and https://github.com/gitpython-developers/GitPython/pull/1702#issuecomment-1761182333 for context. --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5acde1a..2fe73ca 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,4 +8,4 @@ updates: - package-ecosystem: "gitsubmodule" directory: "/" schedule: - interval: "monthly" + interval: "weekly" From 24ecf58262eb2e76906689dbc4e28397f4f628dc Mon Sep 17 00:00:00 2001 From: Antoine C Date: Fri, 8 Dec 2023 16:58:24 +0100 Subject: [PATCH 091/103] fix #101 --- gitdb/test/test_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/test/test_base.py b/gitdb/test/test_base.py index 8fc9e35..17906c9 100644 --- a/gitdb/test/test_base.py +++ b/gitdb/test/test_base.py @@ -73,7 +73,7 @@ def test_streams(self): # test deltapackstream dpostream = ODeltaPackStream(*(dpinfo + (stream, ))) - dpostream.stream is stream + assert dpostream.stream is stream dpostream.read(5) stream._assert() assert stream.bytes == 5 @@ -92,7 +92,7 @@ def test_streams(self): assert istream.size == s istream.size = s * 2 - istream.size == s * 2 + assert istream.size == s * 2 assert istream.type == str_blob_type istream.type = "something" assert istream.type == "something" From 86402e67e7d999b2b2665dc1029c5e1ccd3ada35 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:03:07 +0000 Subject: [PATCH 092/103] Bump actions/setup-python from 4 to 5 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 73b3902..ec7550d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} allow-prereleases: ${{ matrix.experimental }} From 5aeb6e073ebe007d43695976eccdcca64568d025 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:39:28 +0000 Subject: [PATCH 093/103] Bump gitdb/ext/smmap from `256c5a2` to `04dd210` Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `256c5a2` to `04dd210`. - [Commits](https://github.com/gitpython-developers/smmap/compare/256c5a21de2d14aca02c9689d7d63f78c4e0ef61...04dd2103ee6e0b7483889e5feda25053c6df2b52) --- updated-dependencies: - dependency-name: gitdb/ext/smmap dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gitdb/ext/smmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 256c5a2..04dd210 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 256c5a21de2d14aca02c9689d7d63f78c4e0ef61 +Subproject commit 04dd2103ee6e0b7483889e5feda25053c6df2b52 From d50b2e3245f472637c6b86722d6dd969fb4c7183 Mon Sep 17 00:00:00 2001 From: Almaz Ilaletdinov Date: Sun, 9 Jun 2024 14:00:05 +0300 Subject: [PATCH 094/103] Use contextlib.suppress instead of except: pass --- gitdb/db/loose.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 256fec9..87cde86 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -2,6 +2,8 @@ # # This module is part of GitDB and is released under # the New BSD License: https://opensource.org/license/bsd-3-clause/ +from contextlib import suppress + from gitdb.db.base import ( FileDBBase, ObjectDBR, @@ -90,10 +92,8 @@ def readable_db_object_path(self, hexsha): """ :return: readable object path to the object identified by hexsha :raise BadObject: If the object file does not exist""" - try: + with suppress(KeyError): return self._hexsha_to_file[hexsha] - except KeyError: - pass # END ignore cache misses # try filesystem From 5bc95043792c2412b05263fb4bfca67d7923645c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 9 Oct 2024 01:01:55 -0600 Subject: [PATCH 095/103] Add support for Python 3.13 --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 73b3902..8e0ff8e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] include: - experimental: false continue-on-error: ${{ matrix.experimental }} diff --git a/setup.py b/setup.py index f67f7a5..51065c9 100755 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3 :: Only", ] ) From b38cbc43354523ffcd59a58c5a3aded054bd4442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 9 Oct 2024 01:05:50 -0600 Subject: [PATCH 096/103] Use older ubuntu to get Python 3.7 --- .github/workflows/pythonpackage.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 8e0ff8e..40e1c0a 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -8,12 +8,17 @@ on: [push, pull_request, workflow_dispatch] jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + os: [ubuntu-latest] + experimental: [false] include: - - experimental: false + - python-version: "3.7" + os: ubuntu-22.04 + experimental: false continue-on-error: ${{ matrix.experimental }} steps: From 74a0eabbc03209593ea1562498802359ae8a3db7 Mon Sep 17 00:00:00 2001 From: Jonathan Dekhtiar Date: Mon, 23 Dec 2024 23:02:58 -0500 Subject: [PATCH 097/103] Potential Race Condition Fix - OS Rename & Chmod --- gitdb/db/loose.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 87cde86..ccefe40 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -54,6 +54,7 @@ import tempfile import os import sys +import time __all__ = ('LooseObjectDB', ) @@ -205,7 +206,7 @@ def store(self, istream): # END assure target stream is closed except: if tmp_path: - os.remove(tmp_path) + remove(tmp_path) raise # END assure tmpfile removal on error @@ -228,9 +229,25 @@ def store(self, istream): rename(tmp_path, obj_path) # end rename only if needed - # make sure its readable for all ! It started out as rw-- tmp file - # but needs to be rwrr - chmod(obj_path, self.new_objects_mode) + # Ensure rename is actually done and file is stable + # Retry up to 14 times - exponential wait & retry in ms. + # The total maximum wait time is 1000ms, which should be vastly enough for the + # OS to return and commit the file to disk. + for exp_backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: + with suppress(PermissionError): + # make sure its readable for all ! It started out as rw-- tmp file + # but needs to be rwrr + chmod(obj_path, self.new_objects_mode) + break + time.sleep(exp_backoff_ms / 1000.0) + else: + raise PermissionError( + "Impossible to apply `chmod` to file {}".format(obj_path) + ) + + # Cleanup + with suppress(FileNotFoundError): + remove(tmp_path) # END handle dry_run istream.binsha = hex_to_bin(hexsha) From b71e2730c3dcab148816f0193a45550ef0a38c79 Mon Sep 17 00:00:00 2001 From: Jonathan DEKHTIAR Date: Sun, 29 Dec 2024 19:44:26 -0500 Subject: [PATCH 098/103] Update gitdb/db/loose.py Co-authored-by: Sebastian Thiel --- gitdb/db/loose.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index ccefe40..03d387e 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -245,9 +245,6 @@ def store(self, istream): "Impossible to apply `chmod` to file {}".format(obj_path) ) - # Cleanup - with suppress(FileNotFoundError): - remove(tmp_path) # END handle dry_run istream.binsha = hex_to_bin(hexsha) From 104138c742a56d85bd2cb2cd8a9f90336daa5483 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 2 Jan 2025 08:15:19 +0100 Subject: [PATCH 099/103] bump patch level to prepare for next release --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 0b8de13..b4340e4 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +****** +4.0.12 +****** + +- various improvements - please see the release on GitHub for details. + ****** 4.0.11 ****** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 9b77e9f..1fb7df8 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 11) +version_info = (4, 0, 12) __version__ = '.'.join(str(i) for i in version_info) # default imports diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 04dd210..f31bfa3 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 04dd2103ee6e0b7483889e5feda25053c6df2b52 +Subproject commit f31bfa378c8840d38d31e7e11ef2b84f191a491e diff --git a/setup.py b/setup.py index 51065c9..3a91543 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 11) +version_info = (4, 0, 12) __version__ = '.'.join(str(i) for i in version_info) setup( From 775cfe8299ea5474f605935469359a9d1cdb49dc Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 2 Jan 2025 08:20:58 +0100 Subject: [PATCH 100/103] update scripts to allow release (copied from smmap) --- Makefile | 42 +++++++----------------------------------- build-release.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 35 deletions(-) create mode 100755 build-release.sh diff --git a/Makefile b/Makefile index a0a2d0e..20436bb 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,12 @@ -PYTHON = python3 -SETUP = $(PYTHON) setup.py -TESTFLAGS = +.PHONY: all clean release force_release -all:: +all: @grep -Ee '^[a-z].*:' Makefile | cut -d: -f1 | grep -vF all -release:: clean - # Check if latest tag is the current head we're releasing - echo "Latest tag = $$(git tag | sort -nr | head -n1)" - echo "HEAD SHA = $$(git rev-parse head)" - echo "Latest tag SHA = $$(git tag | sort -nr | head -n1 | xargs git rev-parse)" - @test "$$(git rev-parse head)" = "$$(git tag | sort -nr | head -n1 | xargs git rev-parse)" - make force_release +clean: + rm -rf build/ dist/ .eggs/ .tox/ -force_release:: clean - git push --tags - python3 -m build --sdist --wheel +force_release: clean + ./build-release.sh twine upload dist/* - -doc:: - make -C doc/ html - -build:: - $(SETUP) build - $(SETUP) build_ext -i - -build_ext:: - $(SETUP) build_ext -i - -install:: - $(SETUP) install - -clean:: - $(SETUP) clean --all - rm -f *.so - -coverage:: build - PYTHONPATH=. $(PYTHON) -m pytest --cov=gitdb gitdb - + git push --tags origin master diff --git a/build-release.sh b/build-release.sh new file mode 100755 index 0000000..5840e44 --- /dev/null +++ b/build-release.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# This script builds a release. If run in a venv, it auto-installs its tools. +# You may want to run "make release" instead of running this script directly. + +set -eEu + +function release_with() { + $1 -m build --sdist --wheel +} + +if test -n "${VIRTUAL_ENV:-}"; then + deps=(build twine) # Install twine along with build, as we need it later. + echo "Virtual environment detected. Adding packages: ${deps[*]}" + pip install --quiet --upgrade "${deps[@]}" + echo 'Starting the build.' + release_with python +else + function suggest_venv() { + venv_cmd='python -m venv env && source env/bin/activate' + printf "HELP: To avoid this error, use a virtual-env with '%s' instead.\n" "$venv_cmd" + } + trap suggest_venv ERR # This keeps the original exit (error) code. + echo 'Starting the build.' + release_with python3 # Outside a venv, use python3. +fi From 26209528a0303e47c88c174184adbf25d206a824 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 5 Jan 2025 03:21:33 -0500 Subject: [PATCH 101/103] Add SECURITY.md, referencing GitPython's Along with https://github.com/gitpython-developers/smmap/pull/59 and a forthcoming related PR in GitPython, this will fix #116. --- SECURITY.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..95389ff --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,3 @@ +# Security Policy + +See [GitPython](https://github.com/gitpython-developers/GitPython/blob/main/SECURITY.md). Vulnerabilities found in `gitdb` can be reported there. From 4fe56572894f9668c1ffd0808c96aed27c65e584 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 10:38:13 +0000 Subject: [PATCH 102/103] Bump gitdb/ext/smmap from `f31bfa3` to `8f82e6c` Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `f31bfa3` to `8f82e6c`. - [Release notes](https://github.com/gitpython-developers/smmap/releases) - [Commits](https://github.com/gitpython-developers/smmap/compare/f31bfa378c8840d38d31e7e11ef2b84f191a491e...8f82e6c19661f9b735cc55cc89031a189e408894) --- updated-dependencies: - dependency-name: gitdb/ext/smmap dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gitdb/ext/smmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index f31bfa3..8f82e6c 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit f31bfa378c8840d38d31e7e11ef2b84f191a491e +Subproject commit 8f82e6c19661f9b735cc55cc89031a189e408894 From b4fd74ce8e28c372c511db2e0a491fa8b67c93f4 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 26 Jan 2025 11:51:11 -0500 Subject: [PATCH 103/103] Improve description of backoff sequence in db.loose The sequence of backoff wait times used in `gitdb.db.loose` is quadratic rather than exponential, as discussed in: https://github.com/gitpython-developers/gitdb/pull/115#discussion_r1903215598 This corrects the variable name by making it more general, and the comment by having it explicitly describe the backoff as quadratic. This is conceptually related to GitoxideLabs/gitoxide#1815, but this is a non-breaking change, as no interfaces are affected: only a local variable and comment. --- gitdb/db/loose.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 03d387e..e6765cd 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -230,16 +230,16 @@ def store(self, istream): # end rename only if needed # Ensure rename is actually done and file is stable - # Retry up to 14 times - exponential wait & retry in ms. + # Retry up to 14 times - quadratic wait & retry in ms. # The total maximum wait time is 1000ms, which should be vastly enough for the # OS to return and commit the file to disk. - for exp_backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: + for backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: with suppress(PermissionError): # make sure its readable for all ! It started out as rw-- tmp file # but needs to be rwrr chmod(obj_path, self.new_objects_mode) break - time.sleep(exp_backoff_ms / 1000.0) + time.sleep(backoff_ms / 1000.0) else: raise PermissionError( "Impossible to apply `chmod` to file {}".format(obj_path)