class documentation

Lock a ref while making modifications.

Works as a context manager.

Method __enter__ Enter the context manager and acquire the lock.
Method __exit__ Exit the context manager and release the lock.
Method __init__ Initialize a locked ref.
Method delete Delete the ref file while holding the lock.
Method ensure_equals Ensure the ref currently equals the expected value.
Method get Get the current value of the ref.
Method set Set the ref to a new value.
Method set_symbolic_ref Make this ref point at another ref.
Instance Variable _deleted Undocumented
Instance Variable _file Undocumented
Instance Variable _realname Undocumented
Instance Variable _refname Undocumented
Instance Variable _refs_container Undocumented
def __enter__(self) -> locked_ref:

Enter the context manager and acquire the lock.

Returns
locked_refThis locked_ref instance
Raises
OSErrorIf the lock cannot be acquired
def __exit__(self, exc_type: type | None, exc_value: BaseException | None, traceback: types.TracebackType | None):

Exit the context manager and release the lock.

Parameters
exc_type:type | NoneType of exception if one occurred
exc_value:BaseException | NoneException instance if one occurred
traceback:types.TracebackType | NoneTraceback if an exception occurred
def __init__(self, refs_container: DiskRefsContainer, refname: Ref):

Initialize a locked ref.

Parameters
refs_container:DiskRefsContainerThe DiskRefsContainer to lock the ref in
refname:RefThe ref name to lock
def delete(self):

Delete the ref file while holding the lock.

def ensure_equals(self, expected_value: bytes | None) -> bool:

Ensure the ref currently equals the expected value.

Parameters
expected_value:bytes | NoneThe expected current value of the ref
Returns
boolTrue if the ref equals the expected value, False otherwise
def get(self) -> bytes | None:

Get the current value of the ref.

def set(self, new_ref: bytes):

Set the ref to a new value.

Parameters
new_ref:bytesThe new SHA1 or symbolic ref value
def set_symbolic_ref(self, target: Ref):

Make this ref point at another ref.

Parameters
target:RefName of the ref to point at
_deleted: bool =

Undocumented

_file: _GitFile | None =

Undocumented

_realname: Ref | None =

Undocumented

_refname =

Undocumented

_refs_container =

Undocumented