class documentation

Pack index that is stored entirely in memory.

Class Method clone Create a copy of another PackIndex in memory.
Class Method for_pack Create a MemoryPackIndex from a PackData object.
Method __init__ Create a new MemoryPackIndex.
Method __len__ Return the number of entries in this pack index.
Method get_pack_checksum Return the SHA checksum stored for the corresponding packfile.
Method iterentries Iterate over all index entries.
Method object_offset Return the offset for the given SHA.
Method object_sha1 Return the SHA1 for the object at the given offset.
Instance Variable object_format Undocumented
Method _itersha Iterate over all SHA1s in the index.
Instance Variable _by_offset Undocumented
Instance Variable _by_sha Undocumented
Instance Variable _entries Undocumented
Instance Variable _pack_checksum Undocumented

Inherited from PackIndex:

Method __eq__ Check equality with another PackIndex.
Method __iter__ Iterate over the SHAs in this pack.
Method __ne__ Check if this pack index is not equal to another.
Method check Check the consistency of this pack index.
Method close Close any open files.
Method iter_prefix Iterate over all SHA1s with the given prefix.
Method objects_sha1 Return the hex SHA1 over all the shas of all objects in this pack.
Method _object_offset See object_offset.
def clone(cls, other_index: PackIndex) -> MemoryPackIndex:

Create a copy of another PackIndex in memory.

def for_pack(cls, pack_data: PackData) -> MemoryPackIndex:

Create a MemoryPackIndex from a PackData object.

def __init__(self, entries: list[PackIndexEntry], object_format: ObjectFormat, pack_checksum: bytes | None = None):

Create a new MemoryPackIndex.

Parameters
entries:list[PackIndexEntry]Sequence of name, idx, crc32 (sorted)
object_format:ObjectFormatObject format used by this index
pack_checksum:bytes | NoneOptional pack checksum
def __len__(self) -> int:

Return the number of entries in this pack index.

def get_pack_checksum(self) -> bytes | None:

Return the SHA checksum stored for the corresponding packfile.

def iterentries(self) -> Iterator[PackIndexEntry]:

Iterate over all index entries.

def object_offset(self, sha: ObjectID | RawObjectID) -> int:

Return the offset for the given SHA.

Returns: Offset in the pack file

Parameters
sha:ObjectID | RawObjectIDSHA to look up (binary or hex)
Returns
intUndocumented
def object_sha1(self, offset: int) -> bytes:

Return the SHA1 for the object at the given offset.

object_format =

Undocumented

def _itersha(self) -> Iterator[bytes]:

Iterate over all SHA1s in the index.

_by_offset: dict =

Undocumented

_by_sha: dict =

Undocumented

_entries =

Undocumented

_pack_checksum =

Undocumented