module documentation

Ref handling.

Class DictRefsContainer RefsContainer backed by a simple dict.
Class DiskRefsContainer Refs container that reads refs from disk.
Class InfoRefsContainer Refs container that reads refs from a info/refs file.
Class RefsContainer A container for refs.
Exception SymrefLoop There is a loop between one or more symrefs.
Function check_ref_format Check if a refname is correctly formatted.
Function is_local_branch Undocumented
Function parse_symref_value Parse a symref value.
Function read_info_refs Undocumented
Function read_packed_refs Read a packed refs file.
Function read_packed_refs_with_peeled Read a packed refs file including peeled refs.
Function strip_peeled_refs Remove all peeled refs
Function write_info_refs Generate info refs.
Function write_packed_refs Write a packed refs file.
Constant ANNOTATED_TAG_SUFFIX Undocumented
Constant BAD_REF_CHARS Undocumented
Constant HEADREF Undocumented
Constant LOCAL_BRANCH_PREFIX Undocumented
Constant LOCAL_TAG_PREFIX Undocumented
Constant SYMREF Undocumented
Function _import_remote_refs Undocumented
Function _set_default_branch Set the default branch.
Function _set_head Undocumented
Function _set_origin_head Undocumented
Function _split_ref_line Split a single ref line into a tuple of SHA1 and name.
def check_ref_format(refname):

Check if a refname is correctly formatted.

Implements all the same rules as git-check-ref-format[1].

[1] http://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html

Returns: True if refname is valid, False otherwise

Parameters
refname:RefThe refname to check
def is_local_branch(x):

Undocumented

def parse_symref_value(contents):

Parse a symref value.

Returns: Destination

Parameters
contentsContents to parse
def read_info_refs(f):

Undocumented

def read_packed_refs(f):

Read a packed refs file.

Returns: Iterator over tuples with SHA1s and ref names.

Parameters
ffile-like object to read from
def read_packed_refs_with_peeled(f):

Read a packed refs file including peeled refs.

Assumes the "# pack-refs with: peeled" line was already read. Yields tuples with ref names, SHA1s, and peeled SHA1s (or None).

Parameters
ffile-like object to read from, seek'ed to the second line
def strip_peeled_refs(refs):

Remove all peeled refs

def write_info_refs(refs, store):

Generate info refs.

def write_packed_refs(f, packed_refs, peeled_refs=None):

Write a packed refs file.

Parameters
fempty file-like object to write to
packed_refsdict of refname to sha of packed refs to write
peeled_refsdict of refname to peeled value of sha
ANNOTATED_TAG_SUFFIX: bytes =

Undocumented

Value
b'^{}'
BAD_REF_CHARS =

Undocumented

Value
set(b'\x7f ~^:?*[')
HEADREF: bytes =

Undocumented

Value
b'HEAD'
LOCAL_BRANCH_PREFIX: bytes =

Undocumented

Value
b'refs/heads/'
LOCAL_TAG_PREFIX: bytes =

Undocumented

Value
b'refs/tags/'
SYMREF: bytes =

Undocumented

Value
b'ref: '
def _import_remote_refs(refs_container, remote_name, refs, message=None, prune=False, prune_tags=False):

Undocumented

Parameters
refs_container:RefsContainerUndocumented
remote_name:strUndocumented
refs:Dict[str, str]Undocumented
message:Optional[bytes]Undocumented
prune:boolUndocumented
prune_tags:boolUndocumented
def _set_default_branch(refs, origin, origin_head, branch, ref_message):

Set the default branch.

Parameters
refs:RefsContainerUndocumented
origin:bytesUndocumented
origin_head:bytesUndocumented
branch:bytesUndocumented
ref_message:Optional[bytes]Undocumented
Returns
bytesUndocumented
def _set_head(refs, head_ref, ref_message):

Undocumented

def _set_origin_head(refs, origin, origin_head):

Undocumented

def _split_ref_line(line):

Split a single ref line into a tuple of SHA1 and name.