Access to base git objects.
Function S_ISGITLINK Check if a mode indicates a submodule.
Function sha_to_hex Takes a string and returns the hex of the sha within
Function hex_to_sha Takes a hex sha and returns a binary sha
Function valid_hexsha Undocumented
Function hex_to_filename Takes a hex sha and returns its filename relative to the given path.
Function filename_to_hex Takes an object filename and returns its corresponding hex sha.
Function object_header Return an object header for the given numeric type and text length.
Function serializable_property A property that helps tracking whether serialization is necessary.
Function object_class Get the object class corresponding to the given type.
Function check_hexsha Check if a string is a valid hex sha string.
Function check_identity Check if the specified identity is valid.
Function check_time Check if the specified time is not prone to overflow error.
Function git_line Formats items into a space separated line.
Class FixedSha SHA object that behaves like hashlib's but is given a fixed value.
Class ShaFile A git SHA file.
Class Blob A Git Blob object.
Class Tag A Git Tag object.
Class TreeEntry Named tuple encapsulating a single tree entry.
Function parse_tree Parse a tree text.
Function serialize_tree Serialize the items in a tree to a text.
Function sorted_tree_items Iterate over a tree entries dictionary.
Function key_entry Sort key for tree entry.
Function key_entry_name_order Sort key for tree entry in name order.
Function pretty_format_tree_entry Pretty format tree entry.
Class Tree A Git tree object
Function parse_timezone Parse a timezone text fragment (e.g. '+0100').
Function format_timezone Format a timezone for Git serialization.
Function parse_time_entry Parse time entry behavior
Function parse_commit Parse a commit object from chunks.
Class Commit A git commit object
Function _decompress Undocumented
Function _parse_message Parse a message with a list of fields and a body.
def S_ISGITLINK(m):
Check if a mode indicates a submodule.
ParametersmMode to check
Returnsa boolean
def _decompress(string):
Undocumented
def sha_to_hex(sha):
Takes a string and returns the hex of the sha within
def hex_to_sha(hex):
Takes a hex sha and returns a binary sha
def valid_hexsha(hex):
Undocumented
def hex_to_filename(path, hex):
Takes a hex sha and returns its filename relative to the given path.
def filename_to_hex(filename):
Takes an object filename and returns its corresponding hex sha.
def object_header(num_type, length):
Return an object header for the given numeric type and text length.
def serializable_property(name, docstring=None):
A property that helps tracking whether serialization is necessary.
def object_class(type):
Get the object class corresponding to the given type.
ParameterstypeEither a type name string or a numeric type.
ReturnsThe ShaFile subclass corresponding to the given type, or None if type is not a valid type name/number.
def check_hexsha(hex, error_msg):
Check if a string is a valid hex sha string.
ParametershexHex string to check
error_msgError message to use in exception
RaisesObjectFormatExceptionRaised when the string is not valid
def check_identity(identity, error_msg):

Check if the specified identity is valid.

This will raise an exception if the identity is not valid.

ParametersidentityIdentity string
error_msgError message to use in exception
def check_time(time_seconds):

Check if the specified time is not prone to overflow error.

This will raise an exception if the time is not valid.

Parameterstime_infoauthor/committer/tagger info
def git_line(*items):
Formats items into a space separated line.
def _parse_message(chunks):
Parse a message with a list of fields and a body.
Parameterschunksthe raw chunks of the tag or commit object.
Returnsiterator 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.
def parse_tree(text, strict=False):
Parse a tree text.
ParameterstextSerialized text to parse
Returnsiterator of tuples of (name, mode, sha)
RaisesObjectFormatExceptionif the object was malformed in some way
def serialize_tree(items):
Serialize the items in a tree to a text.
ParametersitemsSorted iterable over (name, mode, sha) tuples
ReturnsSerialized tree text as chunks
def sorted_tree_items(entries, name_order):
Iterate over a tree entries dictionary.
Parametersname_orderIf True, iterate entries in order of their name. If False, iterate entries in tree order, that is, treat subtree entries as having '/' appended.
entriesDictionary mapping names to (mode, sha) tuples
ReturnsIterator over (name, mode, hexsha)
def key_entry(entry):
Sort key for tree entry.
Parametersentry(name, value) tuplee
def key_entry_name_order(entry):
Sort key for tree entry in name order.
def pretty_format_tree_entry(name, mode, hexsha, encoding='utf-8'):
Pretty format tree entry.
ParametersnameName of the directory entry
modeMode of entry
hexshaHexsha of the referenced object
Returnsstring describing the tree entry
def parse_timezone(text):
Parse a timezone text fragment (e.g. '+0100').
ParameterstextText to parse.
ReturnsTuple with timezone as seconds difference to UTC and a boolean indicating whether this was a UTC timezone prefixed with a negative sign (-0000).
def format_timezone(offset, unnecessary_negative_timezone=False):
Format a timezone for Git serialization.
ParametersoffsetTimezone offset as seconds difference to UTC
unnecessary_negative_timezoneWhether to use a minus sign for UTC or positive timezones (-0000 and --700 rather than +0000 / +0700).
def parse_time_entry(value):
Parse time entry behavior
ParametersvalueBytes representing a git commit/tag line
ReturnsTuple of (author, time, (timezone, timezone_neg_utc))
RaisesObjectFormatException in case of parsing error (malformed field date)
def parse_commit(chunks):
Parse a commit object from chunks.
ParameterschunksChunks to parse
ReturnsTuple of (tree, parents, author_info, commit_info, encoding, mergetag, gpgsig, message, extra)
API Documentation for Dulwich, generated by pydoctor at 2018-11-17 19:05:54.