class documentation

class DictRefsContainer(RefsContainer):

View In Hierarchy

RefsContainer backed by a simple dict.

This container does not support symbolic or packed references and is not threadsafe.

Method __init__ Undocumented
Method add_if_new Add a new reference only if it does not already exist.
Method allkeys All refs present in this container.
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 loose reference and return its contents.
Method remove_if_equals Remove a refname only if it currently equals old_ref.
Method set_if_equals Set a refname to new_ref only if it currently equals old_ref.
Method set_symbolic_ref Make a ref point at another ref.
Method _notify Undocumented
Method _update Update multiple refs; intended only for testing.
Method _update_peeled Update cached peeled refs; intended only for testing.
Instance Variable _peeled Undocumented
Instance Variable _refs Undocumented
Instance Variable _watchers Undocumented

Inherited from RefsContainer:

Method __contains__ Undocumented
Method __delitem__ Remove a refname.
Method __getitem__ Get the SHA1 for a reference name.
Method __iter__ Undocumented
Method __setitem__ Set a reference name to point to the given SHA1.
Method as_dict Return the contents of this container as a dictionary.
Method follow Follow a reference name.
Method get_symrefs Get a dict with all symrefs in this container.
Method import_refs Undocumented
Method keys Refs present in this container.
Method read_ref Read a reference without following any references.
Method subkeys Refs present in this container under a base.
Method _check_refname Ensure a refname is valid and lives in refs or is HEAD.
Method _log Undocumented
Instance Variable _logger Undocumented
def __init__(self, refs, logger=None):

Undocumented

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.

Parameters
name:RefRef name
ref:ObjectIDRef value
committerUndocumented
timestampUndocumented
timezoneUndocumented
message:Optional[bytes]Undocumented
def allkeys(self):

All refs present in this container.

def get_packed_refs(self):

Get contents of the packed-refs file.

Returns: Dictionary mapping ref names to SHA1s

Note: Will 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.

Returns: The 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.
Parameters
nameName of the ref to peel
def read_loose_ref(self, name):

Read a loose reference and return its contents.

Returns: The contents of the ref file, or None if it does
not exist.
Parameters
namethe refname to read
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, even if applicable for the subclass. It can be used to perform an atomic compare-and-delete operation.

Returns: True if the delete was successful, False otherwise.

Parameters
nameThe refname to delete.
old_refThe old sha the refname must refer to, or None to delete unconditionally.
committerUndocumented
timestampUndocumented
timezoneUndocumented
messageMessage for reflog
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 if applicable for the subclass, and can be used to perform an atomic compare-and-swap operation.

Returns: True if the set was successful, False otherwise.

Parameters
nameThe 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.
committerUndocumented
timestampUndocumented
timezoneUndocumented
messageMessage for reflog
def set_symbolic_ref(self, name, other, committer=None, timestamp=None, timezone=None, message=None):

Make a ref point at another ref.

Parameters
name:RefName of the ref to set
other:RefName of the ref to point at
committerUndocumented
timestampUndocumented
timezoneUndocumented
messageOptional message
def _notify(self, ref, newsha):

Undocumented

def _update(self, refs):

Update multiple refs; intended only for testing.

def _update_peeled(self, peeled):

Update cached peeled refs; intended only for testing.

_peeled: dict =

Undocumented

_refs =

Undocumented

_watchers: set =

Undocumented