The data contained in a packfile.
Pack files can be accessed both sequentially for exploding a pack, and directly with the help of an index to retrieve a specific object.
The objects within are either complete or a delta against another.
The header is variable length. If the MSB of each byte is set then it indicates that the subsequent byte is still part of the header. For the first byte the next MS bits are the type, which tells you the type of object, and whether it is a delta. The LS byte is the lowest bits of the size. For each subsequent byte the LS 7 bits are the next MS bits of the size, i.e. the last byte of the header contains the MS bits of the size.
For the complete objects the data is stored as zlib deflated data. The size in the header is the uncompressed object size, so to uncompress you need to just keep feeding data to zlib until you get an object back, or it errors on bad data. This is done here by just giving the complete buffer from the start of the deflated object on. This is bad, but until I get mmap sorted out it will have to do.
Currently there are no integrity checks done. Also no attempt is made to try and detect the delta case, or a request for an object at the wrong position. It will all just throw a zlib or KeyError.
Class Method | from |
Undocumented |
Class Method | from |
Undocumented |
Method | __enter__ |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | __init__ |
Create a PackData object representing the pack in the given filename. |
Method | __len__ |
Returns the number of objects in this pack. |
Method | calculate |
Calculate the checksum for this pack. |
Method | check |
Check the consistency of this pack. |
Method | close |
Undocumented |
Method | create |
Create an index file for this data file. |
Method | create |
Create a version 1 file for this data file. |
Method | create |
Create a version 2 index file for this data file. |
Method | get |
Given offset in the packfile return compressed data that is there. |
Method | get |
Given an offset in to the packfile return the object that is there. |
Method | get |
Return the expected checksum stored in this pack. |
Method | iterentries |
Yield entries summarizing the contents of this pack. |
Method | iterobjects |
Undocumented |
Method | sorted |
Return entries in this pack, sorted by SHA. |
Property | filename |
Undocumented |
Property | path |
Undocumented |
Method | _get |
Undocumented |
Method | _iter |
Undocumented |
Instance Variable | _file |
Undocumented |
Instance Variable | _filename |
Undocumented |
Instance Variable | _header |
Undocumented |
Instance Variable | _num |
Undocumented |
Instance Variable | _offset |
Undocumented |
Instance Variable | _size |
Undocumented |
dulwich.contrib.swift.SwiftPackData
Create a PackData object representing the pack in the given filename.
The file must exist and stay readable until the object is disposed of. It must also stay the same size. It will be mapped whenever needed.
Currently there is a restriction on the size of the pack as the python mmap implementation is flawed.
Create an index file for this data file.
Returns: Checksum of index file
Parameters | |
filename | Index filename. |
progress | Progress report function |
version | Undocumented |
resolve | Undocumented |
Create a version 1 file for this data file.
Returns: Checksum of index file
Parameters | |
filename | Index filename. |
progress | Progress report function |
resolve | Undocumented |
Create a version 2 index file for this data file.
Returns: Checksum of index file
Parameters | |
filename | Index filename. |
progress | Progress report function |
resolve | Undocumented |
Given offset in the packfile return compressed data that is there.
Using the associated index the location of an object can be looked up, and then the packfile can be asked directly for that object using this function.
dulwich.contrib.swift.SwiftPackData
Given an offset in to the packfile return the object that is there.
Using the associated index the location of an object can be looked up, and then the packfile can be asked directly for that object using this function.
Yield entries summarizing the contents of this pack.
Returns: iterator of tuples with (sha, offset, crc32)
Parameters | |
progress | Progress function, called with current and total object count. |
resolve | Undocumented |