Refs container that reads refs from disk.
Method __init__ Undocumented
Method __repr__ Undocumented
Method subkeys Refs present in this container under a base.
Method allkeys All refs present in this container.
Method refpath Return the disk path of a ref.
Method get_packed_refs Get contents of the packed-refs file.
Method get_peeled Return the cached peeled value of a ref, if available.
Method read_loose_ref Read a reference file and return its contents.
Method set_symbolic_ref Make a ref point at another ref.
Method set_if_equals Set a refname to new_ref only if it currently equals old_ref.
Method add_if_new Add a new reference only if it does not already exist.
Method remove_if_equals Remove a refname only if it currently equals old_ref.
Method _remove_packed_ref Undocumented

Inherited from RefsContainer:

Method import_refs Undocumented
Method keys Refs present in this container.
Method as_dict Return the contents of this container as a dictionary.
Method read_ref Read a reference without following any references.
Method follow Follow a reference name.
Method __contains__ Undocumented
Method __getitem__ Get the SHA1 for a reference name.
Method __setitem__ Set a reference name to point to the given SHA1.
Method __delitem__ Remove a refname.
Method get_symrefs Get a dict with all symrefs in this container.
Method _log Undocumented
Method _check_refname Ensure a refname is valid and lives in refs or is HEAD.
Method _follow Undocumented
def __init__(self, path, worktree_path=None, logger=None):
Undocumented
def __repr__(self):
Undocumented
def subkeys(self, base):
Refs present in this container under a base.
ParametersbaseThe base to return refs under.
ReturnsA set of valid refs in this container under the base; the base prefix is stripped from the ref names returned.
def allkeys(self):
All refs present in this container.
def refpath(self, name):
Return the disk path of a ref.
def get_packed_refs(self):
Get contents of the packed-refs file.
ReturnsDictionary mapping ref names to SHA1s
NoteWill return an empty dictionary when no packed-refs file is present.
def get_peeled(self, name):
Return the cached peeled value of a ref, if available.
ParametersnameName of the ref to peel
ReturnsThe peeled value of the ref. If the ref is known not point to a tag, this will be the SHA the ref refers to. If the ref may point to a tag, but no cached information is available, None is returned.
def read_loose_ref(self, name):

Read a reference file and return its contents.

If the reference file a symbolic reference, only read the first line of the file. Otherwise, only read the first 40 bytes.

Parametersnamethe refname to read, relative to refpath
ReturnsThe contents of the ref file, or None if the file does not exist.
RaisesIOErrorif any other error occurs
def _remove_packed_ref(self, name):
Undocumented
def set_symbolic_ref(self, name, other, committer=None, timestamp=None, timezone=None, message=None):
Make a ref point at another ref.
ParametersnameName of the ref to set
otherName of the ref to point at
messageOptional message to describe the change
def set_if_equals(self, name, old_ref, new_ref, committer=None, timestamp=None, timezone=None, message=None):

Set a refname to new_ref only if it currently equals old_ref.

This method follows all symbolic references, and can be used to perform an atomic compare-and-swap operation.

ParametersnameThe refname to set.
old_refThe old sha the refname must refer to, or None to set unconditionally.
new_refThe new sha the refname will refer to.
messageSet message for reflog
ReturnsTrue if the set was successful, False otherwise.
def add_if_new(self, name, ref, committer=None, timestamp=None, timezone=None, message=None):

Add a new reference only if it does not already exist.

This method follows symrefs, and only ensures that the last ref in the chain does not exist.

ParametersnameThe refname to set.
refThe new sha the refname will refer to.
messageOptional message for reflog
ReturnsTrue if the add was successful, False otherwise.
def remove_if_equals(self, name, old_ref, committer=None, timestamp=None, timezone=None, message=None):

Remove a refname only if it currently equals old_ref.

This method does not follow symbolic references. It can be used to perform an atomic compare-and-delete operation.

ParametersnameThe refname to delete.
old_refThe old sha the refname must refer to, or None to delete unconditionally.
messageOptional message
ReturnsTrue if the delete was successful, False otherwise.
API Documentation for Dulwich, generated by pydoctor at 2018-11-17 19:05:54.