class documentation

A Git pack object.

Class Method from_lazy_objects Create a new pack object from callables to load pack data and index objects.
Class Method from_objects Create a new pack object from pack data and index objects.
Method __contains__ Check whether this pack contains a particular SHA1.
Method __enter__ Undocumented
Method __eq__ Undocumented
Method __exit__ Undocumented
Method __getitem__ Retrieve the specified SHA1.
Method __init__ Undocumented
Method __iter__ Iterate over all the sha1s of the objects in this pack.
Method __len__ Number of entries in this pack.
Method __repr__ Undocumented
Method check Check the integrity of this pack.
Method check_length_and_checksum Sanity check the length and checksum of the pack index and data.
Method close Undocumented
Method entries Yield entries summarizing the contents of this pack.
Method get_raw Undocumented
Method get_raw_unresolved Get raw unresolved data for a SHA.
Method get_ref Get the object for a ref SHA, only looking in this pack.
Method get_stored_checksum Undocumented
Method iterobjects Iterate over the objects in this pack.
Method keep Add a .keep file for the pack, preventing git from garbage collecting it.
Method name The SHA over the SHAs of the objects in this pack.
Method pack_tuples Provide an iterable for use with write_pack_objects.
Method resolve_object Resolve an object, possibly resolving deltas when necessary.
Method sorted_entries Return entries in this pack, sorted by SHA.
Instance Variable resolve_ext_ref Undocumented
Property data The pack data object being used.
Property index The index being used.
Instance Variable _basename Undocumented
Instance Variable _data Undocumented
Instance Variable _data_load Undocumented
Instance Variable _data_path Undocumented
Instance Variable _idx Undocumented
Instance Variable _idx_load Undocumented
Instance Variable _idx_path Undocumented
@classmethod
def from_lazy_objects(cls, data_fn, idx_fn):

Create a new pack object from callables to load pack data and index objects.

@classmethod
def from_objects(cls, data, idx):

Create a new pack object from pack data and index objects.

def __contains__(self, sha1):

Check whether this pack contains a particular SHA1.

def __enter__(self):

Undocumented

def __eq__(self, other):

Undocumented

def __exit__(self, exc_type, exc_val, exc_tb):

Undocumented

def __getitem__(self, sha1):

Retrieve the specified SHA1.

def __init__(self, basename, resolve_ext_ref=None):

Undocumented

Parameters
basenameUndocumented
resolve_ext_ref:Optional[Callable[[bytes], Tuple[int, UnpackedObject]]]Undocumented
def __iter__(self):

Iterate over all the sha1s of the objects in this pack.

def __len__(self):

Number of entries in this pack.

def __repr__(self):

Undocumented

def check(self):

Check the integrity of this pack.

Raises
ChecksumMismatchif a checksum for the index or data is wrong
def check_length_and_checksum(self):

Sanity check the length and checksum of the pack index and data.

def close(self):

Undocumented

def entries(self, progress=None):

Yield entries summarizing the contents of this pack.

Returns: iterator of tuples with (sha, offset, crc32)

Parameters
progressProgress function, called with current and total object count.
def get_raw(self, sha1):

Undocumented

def get_raw_unresolved(self, sha1):

Get raw unresolved data for a SHA.

Returns: Tuple with pack object type, delta base (if applicable),
list of data chunks
Parameters
sha1SHA to return data for
def get_ref(self, sha):

Get the object for a ref SHA, only looking in this pack.

Returns
Tuple[int, int, UnpackedObject]Undocumented
def get_stored_checksum(self):

Undocumented

def iterobjects(self):

Iterate over the objects in this pack.

def keep(self, msg=None):

Add a .keep file for the pack, preventing git from garbage collecting it.

Returns: The path of the .keep file, as a string.

Parameters
msgA message written inside the .keep file; can be used later to determine whether or not a .keep file is obsolete.
def name(self):

The SHA over the SHAs of the objects in this pack.

def pack_tuples(self):

Provide an iterable for use with write_pack_objects.

Returns: Object that can iterate over (object, path) tuples
and provides __len__
def resolve_object(self, offset, type, obj, get_ref=None):

Resolve an object, possibly resolving deltas when necessary.

Returns: Tuple with object type and contents.

def sorted_entries(self, progress=None):

Return entries in this pack, sorted by SHA.

Returns: Iterator of tuples with (sha, offset, crc32)

Parameters
progressProgress function, called with current and total object count
resolve_ext_ref =

Undocumented

@property
data =

The pack data object being used.

@property
index =

The index being used.

Note: This may be an in-memory index

_basename =

Undocumented

_data =

Undocumented

_data_load =

Undocumented

_data_path =

Undocumented

_idx =

Undocumented

_idx_load =

Undocumented

_idx_path =

Undocumented