Known subclasses: dulwich.pack.PackIndex1, dulwich.pack.PackIndex2

Pack index that is based on a file.

To do the loop it opens the file, and indexes first 256 4 byte groups with the first byte of the sha id. The value in the four byte group indexed is the end of the group that shares the same starting byte. Subtract one from the starting byte and index again to find the start of the group. The values are sorted by sha id within the group, so do the math to find the start and end offset and then bisect in to find if the value is present.

Method __init__ Create a pack index object.
Method path Undocumented
Method __eq__ Undocumented
Method close Undocumented
Method __len__ Return the number of entries in this pack index.
Method iterentries Iterate over the entries in this pack index.
Method check Check that the stored checksum matches the actual checksum.
Method calculate_checksum Calculate the SHA1 checksum over this pack index.
Method get_pack_checksum Return the SHA1 checksum stored for the corresponding packfile.
Method get_stored_checksum Return the SHA1 checksum stored for this index.
Method _unpack_entry Unpack the i-th entry in the index file.
Method _unpack_name Unpack the i-th name from the index file.
Method _unpack_offset Unpack the i-th object offset from the index file.
Method _unpack_crc32_checksum Unpack the crc32 checksum for the ith object from the index file.
Method _itersha Yield all the SHA1's of the objects in the index, sorted.
Method _read_fan_out_table Undocumented
Method _object_index See object_index.

Inherited from PackIndex:

Method __ne__ Undocumented
Method __iter__ Iterate over the SHAs in this pack.
Method object_index Return the index in to the corresponding packfile for the object.
Method object_sha1 Return the SHA1 corresponding to the index in the pack file.
Method objects_sha1 Return the hex SHA1 over all the shas of all objects in this pack.
def __init__(self, filename, file=None, contents=None, size=None):

Create a pack index object.

Provide it with the name of the index file to consider, and it will map it whenever required.

@property
def path(self):
Undocumented
def __eq__(self, other):
Undocumented
def close(self):
Undocumented
def __len__(self):
Return the number of entries in this pack index.
def _unpack_entry(self, i):
Unpack the i-th entry in the index file.
ReturnsTuple with object name (SHA), offset in pack file and CRC32 checksum (if known).
def _unpack_name(self, i):
Unpack the i-th name from the index file.
def _unpack_offset(self, i):
Unpack the i-th object offset from the index file.
def _unpack_crc32_checksum(self, i):
Unpack the crc32 checksum for the ith object from the index file.
def _itersha(self):
Yield all the SHA1's of the objects in the index, sorted.
def iterentries(self):
Iterate over the entries in this pack index.
Returnsiterator over tuples with object name, offset in packfile and crc32 checksum.
def _read_fan_out_table(self, start_offset):
Undocumented
def check(self):
Check that the stored checksum matches the actual checksum.
def calculate_checksum(self):
Calculate the SHA1 checksum over this pack index.
ReturnsThis is a 20-byte binary digest
def get_pack_checksum(self):
Return the SHA1 checksum stored for the corresponding packfile.
Returns20-byte binary digest
def get_stored_checksum(self):
Return the SHA1 checksum stored for this index.
Returns20-byte binary digest
def _object_index(self, sha):
See object_index.
ParametersshaA binary SHA string. (20 characters long)_
API Documentation for Dulwich, generated by pydoctor at 2018-11-17 19:05:54.