module documentation
Access to base git objects.
Class |
|
A Git Blob object. |
Class |
|
A git commit object |
Class |
|
SHA object that behaves like hashlib's but is given a fixed value. |
Class |
|
A git SHA file. |
Class |
|
A Git Tag object. |
Class |
|
A Git tree object |
Class |
|
Named tuple encapsulating a single tree entry. |
Exception |
|
An unexpectedly empty file was encountered. |
Exception |
|
A submodule was encountered while resolving a path. |
Function | check |
Check if a string is a valid hex sha string. |
Function | check |
Check if the specified identity is valid. |
Function | check |
Check if the specified time is not prone to overflow error. |
Function | filename |
Takes an object filename and returns its corresponding hex sha. |
Function | format |
Format a timezone for Git serialization. |
Function | git |
Formats items into a space separated line. |
Function | hex |
Takes a hex sha and returns its filename relative to the given path. |
Function | hex |
Takes a hex sha and returns a binary sha |
Function | key |
Sort key for tree entry. |
Function | key |
Sort key for tree entry in name order. |
Function | object |
Get the object class corresponding to the given type. |
Function | object |
Return an object header for the given numeric type and text length. |
Function | parse |
Parse a commit object from chunks. |
Function | parse |
Parse time entry behavior |
Function | parse |
Parse a timezone text fragment (e.g. '+0100'). |
Function | parse |
Parse a tree text. |
Function | pretty |
Pretty format tree entry. |
Function | S |
Check if a mode indicates a submodule. |
Function | serializable |
A property that helps tracking whether serialization is necessary. |
Function | serialize |
Serialize the items in a tree to a text. |
Function | sha |
Takes a string and returns the hex of the sha within |
Function | sorted |
Iterate over a tree entries dictionary. |
Function | valid |
Undocumented |
Constant | BEGIN |
Undocumented |
Constant | MAX |
Undocumented |
Constant | OBJECT |
Undocumented |
Constant | S |
Undocumented |
Constant | ZERO |
Undocumented |
Function | _decompress |
Undocumented |
Function | _parse |
Parse a message with a list of fields and a body. |
Constant | _AUTHOR |
Undocumented |
Constant | _COMMITTER |
Undocumented |
Constant | _ENCODING |
Undocumented |
Constant | _GPGSIG |
Undocumented |
Constant | _MERGETAG |
Undocumented |
Constant | _OBJECT |
Undocumented |
Constant | _PARENT |
Undocumented |
Constant | _TAG |
Undocumented |
Constant | _TAGGER |
Undocumented |
Constant | _TREE |
Undocumented |
Constant | _TYPE |
Undocumented |
Constant | _TYPE |
Undocumented |
Check if a string is a valid hex sha string.
Parameters | |
hex | Hex string to check |
error | Error message to use in exception |
Raises | |
ObjectFormatException | Raised when the string is not valid |
Check if the specified time is not prone to overflow error.
This will raise an exception if the time is not valid.
Parameters | |
time | time in seconds |
Format a timezone for Git serialization.
Parameters | |
offset | Timezone offset as seconds difference to UTC |
unnecessary | Whether to use a minus sign for UTC or positive timezones (-0000 and --700 rather than +0000 / +0700). |
Parse a commit object from chunks.
- Returns: Tuple of (tree, parents, author_info, commit_info,
- encoding, mergetag, gpgsig, message, extra)
Parameters | |
chunks | Chunks to parse |
Parse time entry behavior
Returns: Tuple of (author, time, (timezone, timezone_neg_utc))
Parameters | |
value | Bytes representing a git commit/tag line |
Raises | |
ObjectFormatException in case of parsing error (malformed | |
field date) |
Parse a timezone text fragment (e.g. '+0100').
- Returns: Tuple with timezone as seconds difference to UTC
- and a boolean indicating whether this was a UTC timezone prefixed with a negative sign (-0000).
Parameters | |
text | Text to parse. |
Parse a tree text.
Returns: iterator of tuples of (name, mode, sha)
Parameters | |
text | Serialized text to parse |
strict | Undocumented |
Raises | |
ObjectFormatException | if the object was malformed in some way |
Pretty format tree entry.
Returns: string describing the tree entry
Parameters | |
name | Name of the directory entry |
mode | Mode of entry |
hexsha | Hexsha of the referenced object |
encoding | Undocumented |
Serialize the items in a tree to a text.
Returns: Serialized tree text as chunks
Parameters | |
items | Sorted iterable over (name, mode, sha) tuples |
Iterate over a tree entries dictionary.
Returns: Iterator over (name, mode, hexsha)
Parameters | |
entries | Dictionary mapping names to (mode, sha) tuples |
namebool | If True, iterate entries in order of their name. If False, iterate entries in tree order, that is, treat subtree entries as having '/' appended. |
Parse a message with a list of fields and a body.
- Returns: iterator of tuples of (field, value), one per header line, in the
- order read from the text, possibly including duplicates. Includes a field named None for the freeform tag/commit text.
Parameters | |
chunks:Iterable[ | the raw chunks of the tag or commit object. |