Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gitpython-developers/gitdb
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.0.9
Choose a base ref
...
head repository: gitpython-developers/gitdb
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.0.10
Choose a head ref
  • 11 commits
  • 27 files changed
  • 4 contributors

Commits on Feb 21, 2022

  1. Stop signing releases (#77)

    The key stopped producing correct signatures when upgrading MacOS,
    at least when used by `twine`.
    Byron committed Feb 21, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    Byron Sebastian Thiel
    Copy the full SHA
    4762d99 View commit details

Commits on Mar 15, 2022

  1. .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
    RandyMcMillan authored and Byron committed Mar 15, 2022

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    2ce0e31 View commit details

Commits on Nov 16, 2022

  1. Copy the full SHA
    5f149c1 View commit details
  2. Copy the full SHA
    a6f0856 View commit details
  3. Copy the full SHA
    faed217 View commit details
  4. Copy the full SHA
    7a68270 View commit details

Commits on Nov 17, 2022

  1. Merge pull request #81 from hugovk/master

    Add support for Python 3.10 and 3.11
    Byron authored Nov 17, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3415e08 View commit details

Commits on Nov 23, 2022

  1. Prefer import to __import__

    zwimer committed Nov 23, 2022

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    c3ab5d7 View commit details
  2. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    1edc7d2 View commit details
  3. Merge pull request #82 from zwimer/prefer-standard-import

    Prefer `import` to `__import__`
    Byron authored Nov 23, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    43de984 View commit details

Commits on Nov 24, 2022

  1. bump version to 4.0.10

    Byron committed Nov 24, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    Byron Sebastian Thiel
    Copy the full SHA
    38c68d9 View commit details
6 changes: 3 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -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.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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -7,3 +7,4 @@ dist/
*.so
.noseids
*.sublime-workspace
*.egg-info
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions doc/source/changes.rst
Original file line number Diff line number Diff line change
@@ -2,6 +2,12 @@
Changelog
#########

******
4.0.10
******

- improvements to the way external packages are imported.

*****
4.0.9
*****
9 changes: 4 additions & 5 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -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
18 changes: 8 additions & 10 deletions gitdb/__init__.py
Original file line number Diff line number Diff line change
@@ -12,15 +12,13 @@

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
del smmap
# END handle imports

#} END initialization
@@ -30,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)


12 changes: 6 additions & 6 deletions gitdb/db/base.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions gitdb/db/git.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions gitdb/db/loose.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion gitdb/db/mem.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion gitdb/db/pack.py
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions gitdb/db/ref.py
Original file line number Diff line number Diff line change
@@ -20,15 +20,15 @@ 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):
if attr == '_dbs':
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)
2 changes: 1 addition & 1 deletion gitdb/ext/smmap
2 changes: 1 addition & 1 deletion gitdb/fun.py
Original file line number Diff line number Diff line change
@@ -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"""
4 changes: 2 additions & 2 deletions gitdb/pack.py
Original file line number Diff line number Diff line change
@@ -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):
12 changes: 6 additions & 6 deletions gitdb/stream.py
Original file line number Diff line number Diff line change
@@ -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"""
2 changes: 1 addition & 1 deletion gitdb/test/db/test_ref.py
Original file line number Diff line number Diff line change
@@ -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):
Loading